xpda
xpda

Reputation: 15813

"500 - Internal server error." on IIS app 4.0

I made a simple asp.net web application that does nothing. It works using .net framework 2.0 (as do all the other applications on the server), but when I change it to .net framework 4.0 I get a "500 - Internal server error".

To change to 4.0, I compiled with .Net Framework 4.5.2 (also tried 4.0), and I changed the application pool in IIS to ASP 4.0 integrated.

I set web.config to display errors, but it's still only the vague error message above. I can see no errors or warnings in the system logs. I did register .net framework v4.0.30319.

What can cause this?

web.config:

<?xml version="1.0"?>
<configuration>
  <system.web>
    <compilation strict="false" explicit="true" targetFramework="4.5.2"/>
    <httpRuntime targetFramework="4.5.2"/>
    <customErrors mode="Off">
      <error statusCode="403" redirect="NoAccess.htm"/>
      <error statusCode="404" redirect="FileNotFound.htm"/>
    </customErrors>
    <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
  </system.web>
</configuration>

Upvotes: 5

Views: 5041

Answers (2)

M. Wiśnicki
M. Wiśnicki

Reputation: 6203

Enable and see detailed errors of your web messages whit it you can locate real issue. If you can run the browser on the server, you get details on the error, because the server recognizes that you are local and shows it to you. Event Viewer, also show the details of your error. Try it with debug="true".

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

Upvotes: 2

Tummala Krishna Kishore
Tummala Krishna Kishore

Reputation: 8271

I'm assuming that you did not register .NET 4.0 installation Properly. you need to run in the cmd with following parameters "C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i"

Steps to Install this Command

1.Now you need to start command prompt by typing cmd at the Run command and then execute the command prompt with Administrator rights by right clicking and choosing Run as administrator from the context menu.

2.Then on the command prompt you need to navigate to the Directory that has the aspnet_regiis.exe file for that you need to type
CD C:\Windows\Microsoft.NET\Framework64\v4.0.30319\ And then you need to type the following command and hit enter to register ASP.Net with IIS. aspnet_regiis -i

Upvotes: 2

Related Questions