Azure/WebMatrix web.config 500错误
我已尝试将MIME类型添加到webmatrix web.config文件,以便在Azure中运行:Azure/WebMatrix web.config 500错误,azure,webmatrix-2,Azure,Webmatrix 2,我已尝试将MIME类型添加到webmatrix web.config文件,以便在Azure中运行: <system.webServer> <staticContent> <mimeMap fileExtension=".json" mimeType="application/json" /> </staticContent> </system.webServer> 更新2 我注意到,在本地运行应用
<system.webServer>
<staticContent>
<mimeMap fileExtension=".json" mimeType="application/json" />
</staticContent>
</system.webServer>
更新2
我注意到,在本地运行应用程序(应用程序正常运行)时,错误日志将cars.json文件显示为application/json,而在Azure服务器上,它显示为text/html
Azure服务器似乎正在忽略我的web.config文件和其他内容
(我已经在Azure中启用了调试,但还没有找到错误列表…HTTP 500来自其他方面 我添加了你在一个新的空网站上所做的一切,结果正如预期的那样 要测试的URL: 以下是来自请求的fiddler跟踪:
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
,或者类似的东西。查看如何启用日志记录
更新
更新问题后,显然cars.json
不是真实的static
文件。所以这个问题有点混乱。您在这个“文件”中执行什么类型的脚本
更新2
这是您的json:
显然,你对网站的其他设置有问题。正如我所说的-打开所有日志记录并检查真正的错误消息。我的web.config文件中只有:Ok,所以我找到了错误。我在Azure for.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}