[英]MVC 4 Azure web role: Error 500 when adding the “tracing” element to web.config
[英]Azure/WebMatrix web.config 500 Error
我試圖將MIME類型添加到webmatrix web.config文件中以在Azure中運行:
<system.webServer>
<staticContent>
<mimeMap fileExtension=".json" mimeType="application/json" />
</staticContent>
</system.webServer>
但是在嘗試加載json文件時出現500(內部服務器錯誤)。
該站點在本地工作。
我需要在Azure中做其他事情嗎?
(編輯:)
我在web.config中擁有的全部是:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SqlServerCe.4.0" />
<add invariant="System.Data.SqlServerCe.4.0" name="Microsoft® SQL Server® Compact 4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
</DbProviderFactories>
</system.data>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".json" mimeType="application/json" />
</staticContent>
</system.webServer>
</configuration>
沒有MIME類型的位是由webMatrix生成的。
控制台錯誤:
GET http://carlistings.azurewebsites.net/CarListings/data/cars.json?_dc=1364378861597&page=1&start=0&limit=25 500(內部服務器錯誤)
更新
該文件不會更改,並由Sencha Architect教程應用程序的JavaScript調用。
{
"img" : "2004_Porsche_911_Carrera_type_997.jpg",
"manufacturer" : "Porsche",
"model" : "911",
"price" : 135000,
"wiki" : "http://en.wikipedia.org/wiki/Porsche_997",
"quality" : [{
"name" : "overall",
"rating" : 1
},{
"name" : "mechanical",
"rating" : 4
},{
"name" : "powertrain",
"rating" : 2
},{
"name" : "body",
"rating" : 4
},{
"name" : "interior",
"rating" : 3
},{
"name" : "accessories",
"rating" : 2
}]
}
更新2
我注意到在本地運行應用程序(應用程序正常運行的地方),錯誤日志將cars.json文件顯示為application / json,而在Azure服務器上,它顯示為text / html。
看來Azure服務器正在用其他東西忽略我的web.config文件...
(我已經在Azure中啟用了調試功能,但是還找不到錯誤列表...)
HTTP 500來自其他內容。
我恰好在新的空WebSite中添加了您所做的操作,結果與預期的一樣。
要測試的網址: http : //jsonp.azurewebsites.net/demo.json
這是來自請求的提琴手跟蹤:
GET http://jsonp.azurewebsites.net/demo.json HTTP/1.1
User-Agent: Fiddler
Host: jsonp.azurewebsites.net
響應也與預期的一樣:
HTTP/1.1 200 OK
Content-Length: 30
Content-Type: application/json
Last-Modified: Wed, 27 Mar 2013 09:03:09 GMT
Accept-Ranges: bytes
ETag: "cc2c13e7c92ace1:0"
Server: Microsoft-IIS/7.5
.. aditional header omitted for readability
Date: Wed, 27 Mar 2013 09:03:52 GMT
{"title":"demo","count":10}
我建議您打開所有可能的日志記錄並檢查錯誤日志。 您很可能兩次定義了system.webServer
或類似的東西。 查看有關如何啟用日志記錄的SO問題 。
更新
更新問題后,很明顯cars.json
不是真正的static
文件。 所以問題有點混亂。 您在此“文件”中執行哪種類型的腳本?
更新2
這是您的json: http : //jsonp.azurewebsites.net/demo.json
顯然您在其余的網站設置上遇到了問題。 如我所說-打開所有日志記錄並檢查真正的錯誤消息。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.