简体   繁体   中英

Deploying ASP.NET to IIS returns 500

When deploying a website to IIS, it returns a 500.19 error; meaning a config error.

This is my web config file (auto-generated)

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <location path="." inheritInChildApplications="false">
    <system.webServer>
      <handlers>
        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
      </handlers>
      <aspNetCore processPath="dotnet" arguments=".\SiteManager.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
    </system.webServer>
  </location>
</configuration>

After searching on the web I found "solutions". Which didn't seem to work.

All being on the lines of this:

<system.web>
  <customErrors mode="Off" />
  <compilation debug="true" />
</system.web>
<system.webServer>
  <httpErrors errorMode="Detailed" />
  <asp scriptErrorSentToBrowser="true" />
</system.webServer>

But doesn't seem to work.

I have two web sites on IIS. One is .NET Framework and the other is .NET Core.

The config above is for the .NET Core.

In IIS I can access/view the settings for the standard .NET website but for the Core website it won't allow me to view the settings, displaying an error box, mentioning an error with the web.config file.

Key Info:

  • Windows Server 2016,
  • IIS Version 10.0.14393.0

EDIT

So after reading a blog which was commented: I have followed some steps in microsoft's documentation - which was linked in the blog - made some changes. First of all I no longer have a error page; I have a new page which is shown below.

在此处输入图片说明

Originally I was getting an error page which only said "Internal server error" with no meaningful information - no error details at all.

I Installed a .NET Core Hosting service (somethng like that, sorry if thats not helpful) from microsoft's documentation, added permissions and changed application pool to "No managed code", which gave me the above image.

UPDATE

After playing around with settings, and reading through Microsoft docs, I managed to find a/the solution.

First of all: I deleted the app - I thought a fresh start would be best. Then I created a new IIS website.

Once I did that, I went to the Application Pool for the website. Within "Basic Settings" there is a dropdown option called ".NET CLR version", this needs to be set to "No Managed Code".

One more step: I went to the Advanced Settings of the application pool and changed the Identity to something which had permission to the virtual directory; in this case "LocalSystem".

Published again just to make sure everything was new, fired up localhost and everything worked!

ps thanks for the comments!

  1. Press Win Key+R to Open Run Window
  2. in the Run Window, enter "OptionalFeatures.exe"
  3. in the features window, Click: "Internet Information Services"
  4. Click: "World Wide Web Services"
  5. Click: "Application Development Features"
  6. Check the features.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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