HTTP 500 Internal Error - IIS websites - asp.net

I have installed SP 2010 in a Windows Server 2008 R2 loaded environment. I have been using VS 2010 for developing application pages for SP 2010.
I make use of wsp builder to package all my dlls, pages, scripts and images into a solution package and deploy it in the web applications.
Everything was working like a charm. I started enduring a torrid time when all of a sudden my web applications started popping up with 'HTTP 500 Internal Server Error'. This started happening after I made some drastic changes in my application pages and deployed it.
I tried creating new web applications but its not doing me any good. Any insights on what could be the source of this issue?
Regards,
Raghuraman.V

Fixed this problem by editing the Web.config and applicationhost.config.
C:\Users\\Documents\IISExpress\config or right click the IIS Express icon on the tray and view all application and click the desired website and then click the configuration file link.
Comment out
<error statusCode="500" prefixLanguageFilePath="%IIS_BIN%\custerr" path="500.htm" />
Set the parent node to <httpErrors errorMode="DetailedLocalOnly"
Set the httpErrors to Allow
<section name="httpErrors" overrideModeDefault="Allow" />
Change your web project web.config HttpErrors
<httpErrors errorMode="Custom" existingResponse="Auto">
That should fix it, its basically saying that "I dont want IIS Express to override the configuration of my site".

To resolve, you should first instruct IIS to display detailed error messages, instead of just "500".
Adjust your web.config file and set custom errors to off:
<customErrors mode="Off" />
(case-sensitive).
In addition, if you are using Internet Explorer, turn of the advanced option "Show friendly error messages".

To help others, here there is a guide that helped me to find what was wrong with my setup (credits to Rick Barber):
Working past 500
Load the site from a browser located on the same server. In IE you may need to turn off ‘show friendly http errors.’
Temporarily add the following within the appropriate tags in your web.config file:
<configuration>
<system.webServer>
<httpErrors errorMode="Detailed" />
</system.webServer>
<system.web>
<customErrors mode="Off" />
<compilation debug="true" />
</system.web>
</configuration>
Open up IIS Manager and try to open up some of the different features by double clicking on the icon. If there is an error in the web.config file and it can’t even parse it, sometimes you will get a helpful error.
Look in Windows Event Viewer. Sometimes you can find the detailed error logged in there, particularly Application Event Viewer.
Setup Failed Request Tracing. This is especially helpful if it is an intermittent 500 error.
Look through the web log files. This is especially helpful for an intermittent 500 error. You can often parse the log files to see if there is a trend with a specific page that is throwing a 500 error.

Related

How to troubleshoot problems with web.config when deploying an ASP.NET Core Web API project to IIS

I have built an ASP.NET Core Web API in Visual Studio 2017 using the Web API template. When I test it during development it runs using IIS Express and works as expected. The index.html file is served from the wwwroot folder, makes some AJAX requests to the ASP.NET server which makes some HTTP requests to a third party API to obtain some data which is eventually returned to the browser. No datbase involved. I tried to publish to IIS so that another person at my company can use it locally on their machine (which will have IIS running). I published through Visual Studio 2017's publisher:
Right click on project and publish to IIS (following directions from this tutorial: https://learn.microsoft.com/en-us/aspnet/web-forms/overview/deployment/visual-studio-web-deployment/deploying-to-iis)
When I publish, a web page opens with the URL I put as the destination URL:
localhost/ProjectName
but I get this error: HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
There is not config error identified on that screen.
Here's what my web.config looks like:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule"
resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\StandardsGenerator.dll"
stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</configuration>
<!--ProjectGuid: 78162755-cd01-4a5c-8863-1087bd7f6f8f-->
Is there something wrong with this configuration? If anyone can point to resources that describe what should be in a web.config file that may be helpful.
Also, when I publish the app and navigate to localhost/ProjectName I expect an index.html file to be served from the wwwroot directory. In my test environment I configured this in my LaunchSettings.json. Where do I configure the start page for a published app?
Regarding 500.19 errors, there are multiple reasons why you could encounter this error. To troubleshoot this further, please enable detailed errors for this application from IIS. To do so, launch IIS, select the specific website. Open Error pages section in the center panel. Right click on the page and select "Edit Feature Settings". Choose "Detailed errors" here. You can also follow this blog which speaks on the same lines - https://blogs.msdn.microsoft.com/rakkimk/2007/05/25/iis7-how-to-enable-the-detailed-error-messages-for-the-website-while-browsed-from-for-the-client-browsers/
Reproduce the issue and share the error message here. IIS generally gives out which module/configuration needs tweaking.
To answer your second question regarding start page, Select the website, click on "Default Document" and add the "index.html" page here and move it to top. This way, whenever the user accesses your website, he will see the index.html first.

Custom 404 error page in Sitecore don't appears when file (.pdf and other) not found

I've created a custom error page, using this article. This custom error page appears only when aspx page isn't find, and when file(like pdf and other) isn't find - default google's error page appears. How to get custom error page for files? I've tryed to implement this solution on two different machines: on local machine custom error page appears for both .aspx pages and files, but on a server this solution works only for .aspx pages, though config files are the same. What I'm missing? Maybe there are different IIS configuration on this machines, or something? Thanks in advance.
I think this will help you.
<system.web>
<customErrors defaultRedirect="Error.aspx" mode="On">
<error statusCode="500" redirect="Error.aspx"/>
</customErrors>
</system.web>
U can add additional tags and mention available error codes and the page where you want to redirect.
Try setting your Error Page directly in IIS. Take a snapshot of your Web.config before you do this as I'm pretty sure it's going to be modified by IIS once you make this settings change. If memory serves me right you'll see this change in system.webServer and not system.web.
Be advised, if you are operating in a web far though, using mixed version of IIS (Server 2008 and Server 2008 R2 for instance), I've found the settings for 2008 R2 to not be compatible with 2008.

Server error in '/' Application (ASP.net)

i am developing a website in ASP .Net with Visual Studio 2010. I don't have yet attached any database, it is plain html with a lot of CSS and a little bit of Visual Basic. I rented web server space from a company. With FileZilla i uploaded the Published Content and placed them in wwwroot directory. When i visit the website from my browser i get the error below:
Server Error in '/' Application.
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Details: To enable the details of this specific error message to be viewable on remote machines, please create a tag within a "web.config" configuration file located in the root directory of the current web application. This tag should then have its "mode" attribute set to "Off".
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's configuration tag to point to a custom error page URL.
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>
I googled it and found some answers but none fitted my case. I should mention that i am using windows 7 and IIS7, and that locally the site works fine. I thought that i might have made mistake in the code so i tried to upload the template website that visual studio has for default. But the same error still comes up. I tried to upload a plain html site and it worked. I tried to make a plain "hello world" aspx and asp file and it worked. Does anyone have experienced the same problem, and if so how can solve it?
Thank you
Put <customErrors mode="Off"/> in web.config, then it will show the detail error. It is difficult to say anything at this point.
This error can be caused by a virtual directory not being configured as an application in IIS.
Remove section <system.codedom> ...... </system.codedom> from Web.config file

HTTP Handler doesn't hitted, while it run over cloud, when request needs to be redirected to another Server from IIS?

My Asp.net application is hosted over Azure Cloud,
In that application I do have a Java Chat control, which has its server on Linux,
now I have created a HTTPHandler to redirect that chat request to the Linux server, but some how it doesn't work over the Cloud environment (though it works very well on web environment)
it shows the below error
Microsoft Visual Studio
Windows Azure Tools for Microsoft Visual Studio
There was an error attaching the debugger to the IIS worker process for URL 'http://127.255.0.0:82/' for role instance 'deployment16(315).Cloud.AnotherHttpHandler_IN_0'. Unable to start debugging on the web server. See help for common configuration errors. Running the web page outside of the debugger may provide further information.
Make sure the server is operating correctly. Verify there are no syntax errors in web.config by doing a Debug.Start Without Debugging. You may also want to refer to the ASP.NET and ATL Server debugging topic in the online documentation.
I have even put the Handler under System.webServer as well in the web.config file, see below code
<system.web>
<httpHandlers>
<add verb="*" path="http-bind/*"
type="HelloWorldHandler"/>
</httpHandlers>
</system.web>
<system.webServer>
<handlers>
<add verb="*" path="http-bind/*" name="HelloWorldHandler" type="HelloWorldHandler"/>
</handlers>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
I don't know what restricts it over the cloud environment.
Please take a look at this question to see how to configure httpHandlers for running in Azure.
Most importantly - remove the httpHandlers section under the system.web and leave only handlers under system.webServer. Then add also the resourceType="Unspecified" attribute to the handler declaration. This should solve your issue.
I too had same problem.
I fixed it in following way .
The Problem was my machine is 32 bit and the azure server is 64 bit.
In Order to solve the problem i only changed Enable 32 bit option in
the advance setting of application pool. And the Original code worked
out fine.
i got this help from this Link

Redirect all asp.net errors to one page preferably through IIS

I am trying to remove all logging and tracing errors on a company website without having to run through and change all of the debugging ="true" statements (several hundred). We will refactor these later however, today, I am looking for a way to push all asp related errors to simple error page or even make everything a 404 error.
Is this possible or am I going to have to change all debug values?
relevant environment info:
.net framework 2.0, iis 7.0
You should be able to use the customErrors section of the web.config to push all errors to a default error page. Something along the lines of:
<configuration>
<system.web>
<customErrors defaultRedirect="GenericError.htm"
mode="RemoteOnly">
</customErrors>
</system.web>
</configuration>

Resources