我的应用程序在asp.net mvc中遇到问题。 在我的应用程序中,我使用FullCalendar jQuery whith请求的JSON数组中的事件。 jQueryCalendar如下所示。NetworkError:500当在主机上请求JSON时发生内部服务器错误
function renderCalendar() {
$("#cal").fullCalendar({
header: {
left: 'prev, next today',
center: 'title',
right: 'agendaDay, month'
},
height: 'auto',
fixedWeekCount: false,
firstDay: 1,
editable: false,
allDaySlot: false,
selectable: true,
slotMinutes: 15,
axisFormat: 'HH:mm',
eventLimit: true,
businessHours: {
start: '07:00',
end: '23:00'
},
eventLimitClick: 'day',
views: {
month: {
eventLimit: 8
}
},
lang: 'pl',
displayEventEnd: true,
timeFormat: {
month: "HH:mm"
},
events: {
url: '/Schedules/GetEvents/',
type: 'GET',
data: {
department_term: current_department,
}
},
dayClick: function (date, jsEvent, view) {
$('#cal')
.fullCalendar('changeView', 'agendaDay');
$('#cal')
.fullCalendar('gotoDate', date.format());
}
});
我的控制器动作看起来象下面这样:
public JsonResult GetEvents(DateTime start, DateTime end, string department_term)
{
operations to generating listOfEvents
var results = listOfEvents.ToArray();
return Json(results, JsonRequestBehavior.AllowGet);
}
一切正常,在我的视觉本地主机上。但我必须将应用程序部署到somme.com,现在如果我打开日历,则会出现NetworkError:500内部服务器错误(在firefox中观看firebug)。我在firebug中发现答案的标题有一个Content-Type文本/ html; charset = utf-8而不是 Content-Type application/json; charset = utf-8 - 就像本地主机一样。 它可能是什么?
请帮帮我。
要melaspelas 我加入到我的配置代码,就像你说的。就是这个。
但是,这仍然是行不通的。
我仍然有我的回答标题:
Content-Length 75
Content-Type text/html
Date Fri, 15 May 2015 10:45:26 GMT
Server Microsoft-IIS/8.5
,并请求头:
Accept application/json, text/javascript, */*; q=0.01
Accept-Encoding gzip, deflate
Accept-Language pl,en-US;q=0.7,en;q=0.3
Content-Type application/json; charset=utf-8
Cookie b=b; ...
Host staff-net.somee.com
Referer http://staff-net.somee.com/Schedules/Calendar
User-Agent Mozilla/5.0 (Windows NT 6.3; WOW64; rv:37.0) Gecko/20100101 Firefox/37.0
X-Requested-With XMLHttpRequest
要peinearydevelopment: 您的参数不改变任何东西。
在Visual Studio的本地主机,我有:
在我的答案标题:
Cache-Control private, s-maxage=0
Content-Length 15263
Content-Type application/json; charset=utf-8
Date Fri, 15 May 2015 15:16:56 GMT
Server Microsoft-IIS/8.0
X-AspNet-Version 4.0.30319
X-AspNetMvc-Version 5.0
X-Powered-By ASP.NET
X-SourceFiles =?UTF-8?B?QzpcVXNlcnNcbGtvemxvd3NraVxEb2N1bWVudHNcVmlzdWFsIFN0dWRpbyAyMDEzXFByb2plY3RzXFNUQUZGLk5FVFxTVEFGRi5ORVRcU2NoZWR1bGVzXEdldEV2ZW50c1w
=?=
,并在请求头:
Accept application/json, text/javascript, */*; q=0.01
Accept-Encodingg zip, deflate
Accept-Language pl,en-US;q=0.7,en;q=0.3
Cookie __RequestVerificationToken=LI...
Host localhost:50206
Referer http://localhost:50206/Schedules/Calendar
User-Agent Mozilla/5.0 (Windows NT 6.3; WOW64; rv:37.0) Gecko/20100101 Firefox/37.0
X-Requested-With XMLHttpRequest
而上托管我有:
回答头
Cache-Control private, s-maxage=0
Content-Length 2903
Content-Type text/html; charset=utf-8
Date Fri, 15 May 2015 15:27:00 GMT
Server Microsoft-IIS/8.5
X-AspNet-Version 4.0.30319
X-AspNetMvc-Version 5.0
X-Frame-Options SAMEORIGIN
X-Powered-By ASP.NET
请求头:
Accept application/json, text/javascript, */*; q=0.01
Accept-Encoding gzip, deflate
Accept-Language pl,en-US;q=0.7,en;q=0.3
Cookie b=b; b=b; questVerificationToke...
Host staff-net.somee.com
Referer http://staff-net.somee.com/Schedules/Calendar
User-Agent Mozilla/5.0 (Windows NT 6.3; WOW64; rv:37.0) Gecko/20100101 Firefox/37.0
X-Requested-With XMLHttpRequest
2015-05-13
Łukasz_K
+0
你检查你的IIS中的MIME类型? –
+0
谢谢你的回答。我从链接中读取信息,但我的应用程序部署在主机上,并且我无法访问服务器的配置。有其他解决方法吗?例如在我的应用程序的本地Web.config? –
+0
我更新了我的答案与web.config设置 –