ASP.NET 5启动应用程序时发生错误 [英] ASP.NET 5 An error occurred while starting the application

查看:109
本文介绍了ASP.NET 5启动应用程序时发生错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

发布ASP.NET Web App之后,我试图将网站托管在本地服务器上.但是,当我启动它时,它在浏览器中给了我这个错误:

After publishing an ASP.NET Web App, I'm trying to host the website on my local server. However, when I start it up, it gives me this error in my browser:

糟糕. 500 Internal Server Error启动内部服务器时发生错误 应用程序.

Oops. 500 Internal Server Error An error occurred while starting the application.

如何调试此错误是什么?在Visual Studio中开始使用IISExpress和"Web"时,该网站可以运行(调试和发布配置).

How can I debug what this error is? The website works (both Debug and Release configurations) when starting using IISExpress and "web" in Visual Studio.

我正在使用开发环境,并且已经指定了app.UseDeveloperExceptionPage();.

I am using the Development environment, and I have already specified app.UseDeveloperExceptionPage();.

我已按照说明此处部署到IIS.

I have followed the instructions here to deploy to IIS.

我还尝试了在此处提供的建议(重新发布为在发布之前删除所有现有文件"已选中). (那里的OP有一个略有不同的错误,所以这就是为什么我要发布一个新问题.)

I've also tried the suggestion offered here (re-publishing with "Delete all existing files prior to publish" selected). (The OP there has a slightly different error, so that's why I'm posting a new question.)

我在互联网上找了好几个小时,但似乎没有太多的内容.有什么想法吗?

I've looked for hours on the internet, but there doesn't seem to be much content about it. Any ideas?

我在Windows 7上,使用的是ASP.NET 5 RC1.

I am on Windows 7, using ASP.NET 5 RC1.

推荐答案

您应该在web.config文件中设置stdoutLogEnabled=true,以查看实际发生的错误.您可以使用stdoutLogFile参数指示这些文件的写入位置.下面的屏幕快照示例将写入stdoutLogFile=".\logs\stdout". (您应该确保目录存在;应用程序不会创建该目录)

You should set the stdoutLogEnabled=true in the web.config file to see the actual error that is happening. You can direct where these files are written with the stdoutLogFile argument; the screenshot example below writes to stdoutLogFile=".\logs\stdout". (You should ensure the directory exists; the app won't create it)

由于无法找到正确的配置文件,因此默认环境为生产环境.它是在Visual Studio中的项目属性中显式设置的.

As for not being able to find the proper config file yes the default environment is production. It is set to development explicitly in visual studio in the project properties.

更新:在 AspNetCore RTM 中,该模块在web.config的system.webServer节点下称为aspnetCore.而且,正如@ErikE在评论中指出的那样,web.config现在位于项目的根目录中,而不是以前版本中的wwwroot下.

Update: In AspNetCore RTM the module is called aspnetCore under the system.webServer node in web.config. Also, as @ErikE pointed out in comments, the web.config is now located in the root of the project and not under wwwroot as in previous releases.

这篇关于ASP.NET 5启动应用程序时发生错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆