How to solve internal server error 500.19 after up

2019-09-15 14:18发布

I had an application in visual studio 2015 with asp.net core & angular 2. I just upgraded the application on visual studio 2017. The problem is when i run the application the following error occured: enter image description here

I dont know what i am doing wrong or what is the problem? Can any one tell me what is the issue?

Here is the log file image:

enter image description here

2条回答
Evening l夕情丶
2楼-- · 2019-09-15 14:36

guess: Are you using IIS Express?

In such case, it reminds me an error I stumbled upon some time ago - one time when I was overzealous at cleaning my hard drive, and second time when was switching between VisualStudio versions (2013/2015 or something like that).

It turns out that what you have in your project files is not enough to run it on IIS (obvious - that's the standalone server, you have to configure it) but also not enough to run IIS Express (yup!). IIS Express has its own applicationHost.config file and VS creates and manages it for you (correctly, to some extent). However, that's not all. VisualStudio also creates a directory structure under your Documents folder. If I remember correctly, IIS Express considers these folders to be the root directories of your website upon which virtual directories with your code are mounted.

Now, the fun part: when IIS Express starts up, it expects these folders to exist and checks for root web.config files there. Almost always, the web.config files are missing - and that's OK because you don't want them, you have them in your apps in virtual directories.

But what's important is that IIS Express expects that directories. Usually they are completly empty, but they need to exist. If they don't exist - you will get a 500-class error telling you that "web.config" file cannot be accessed. What's really happening is that IIS Express cannot check if the file exists becuase the .. directory is inaccessible.

Look at the error screen you posted. In the middle of it, you have a line:

c:\users\zeshan.munir\documents\visual studio 2017\projects\restaurant\restaurant.web\web.config

go there and check if the directory exists. I bet it does not. Maybe your VS2017 did not create the "visual studio 2017". Or maybe it's the restaurant\restaurant.web which exists under visual studio 2015 folder but not under visual studio 2017 one.

If the folder(s) don't exist - simply create them - and it should fix it.

I think you can also do the same when you go to the ProjectProperties and "Web" tab, pick IIS Express as deployment target and press "Create Virtual directory" (even though it may seem like it was already configured).

查看更多
贼婆χ
3楼-- · 2019-09-15 14:38

It seems that IIS cannot access to web.config file. I understand from the error page that the web site is located under another user's documents folder. Run visual studio as administrator might solve the problem.

查看更多
登录 后发表回答