简体   繁体   English

使用EF7应用程序时出现ASP.NET 5 IIS 500错误

[英]ASP.NET 5 IIS 500 error with EF7 application

I am hosting an application in IIS 8 which is developed in ASP.NET 5, MVC 6, and EF7. 我在IIS 8中托管一个应用程序,它是在ASP.NET 5,MVC 6和EF7中开发的。 I have created API for the application which is accessible via http://localhost/api and I have created few controllers to access data. 我已经为应用程序创建了API,可以通过http://localhost/api ,我创建了几个控制器来访问数据。

When I access the API from visual studio everything works fine, and I able to retrieve JSON data back. 当我从visual studio访问API时,一切正常,我能够检索JSON数据。 But when I host the application IIS 8 and browser localhost/api/controller , I get 500 error in IIS logs. 但是当我托管应用程序IIS 8和浏览器localhost/api/controller ,IIS日志中出现500错误。 I also have http platform handler 1.2 installed on windows server 2012 r2 server. 我还在Windows Server 2012 r2服务器上安装了http platform handler 1.2 I am actually able to browse static pages and other links like localhost/home , but when I try to access api controller I get 500 error code back. 我实际上能够浏览静态页面和其他链接,如localhost/home ,但是当我尝试访问api控制器时,我得到500错误代码。

Now when I use execute web.cmd file from the application to self host the application and browse localhost:5000/api/controller , I am able to retrieve json data back, but not from IIS hosted site. 现在,当我使用应用程序中的执行web.cmd文件来自托管应用程序并浏览localhost:5000/api/controller ,我能够检索json数据,但不能从IIS托管站点检索。

Since I dont know what is the problem, I enabled Failed request tracing rules and I was able to capture logs with 500 error. 由于我不知道是什么问题,我启用了Failed request tracing rules ,我能够捕获500错误的日志。 Below is the screenshot: 以下是截图:

在此输入图像描述 在此输入图像描述 在此输入图像描述 在此输入图像描述 在此输入图像描述 在此输入图像描述 在此输入图像描述 在此输入图像描述 在此输入图像描述

Not getting this from your failed request logs, but might I suggest the usual suspects since you say it works outside of IIS: 没有从失败的请求日志中获取此信息,但我可能会建议通常的嫌疑人,因为您说它在IIS之外工作:

  1. Confirm that the App Pool is set to work with .NET 5.0 and isn't set to a different CLR like 2.0 or 4.0. 确认应用程序池已设置为使用.NET 5.0,并且未设置为不同的CLR,如2.0或4.0。 ( Actually strike this, since non-API MVC controllers wouldn't have worked at all in that case... ) 实际上是打击这个,因为非API MVC控制器在这种情况下根本不会工作......

  2. Confirm that the App Pool is running with an Account that has sufficient database permissions if using NTLM security with SQL, since the execution context may be different when running IIS Express from Visual Studio versus IIS. 如果使用带有SQL的NTLM安全性,请确认应用程序池正在使用具有足够数据库权限的帐户运行,因为从Visual Studio到IIS运行IIS Express时执行上下文可能不同。

I would also suggest checking the Windows Error logs, not just request trace.... 我还建议检查Windows错误日志,而不仅仅是请求跟踪....

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM