web.config ignores customerrors="on" attribute - iis

Hi I've got a site where I get the classic:
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.
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>
The problem is that although I change CustomErrors to On I can't see the error, and the xml of the web.config is not malformed since I've tried inducing this error and IIS told me, so it must be something else, but what should I look for?
Edit
I Should mention, that I only get this error when I publish my site, web.config doesn't return an error locally, only when I upload to production. I can't even get an html page to display, it still returns the web config error to me

If your using a web.config then I am assuming that you have an ASP.Net application. The web.config stores configurational data for a .NET application. If you don't create an application within your virtual directory then you will see the error you are because there is no application for IIS to serve. This link should help.

Related

404 Custom errors not shown for aspx extensions

I created a 404.html page and set it in Error Documents. It works well for everything except aspx pages. How can I redirect those pages also?
Thanks
As far as I know, if you want to show custom 404 error in asp.net web form application, you should use the asp.net custom error page not IIS error page.
About how to set it ,you could refer to below config.
<system.web>
<customErrors mode="On" >
<error statusCode="404" redirect="error.html"/>
</customErrors>
</system.web>
Notice: The error.html should put in your asp.net web applicaton's root path.
More details,you could refer to below article:
https://learn.microsoft.com/en-us/aspnet/web-forms/overview/older-versions-getting-started/deploying-web-site-projects/displaying-a-custom-error-page-cs

web.config causes HTTP 500 issue with virtual directory in IIS

I'm fairly new to IIS so apologies if this is a basic question.
I have an IIS config serving an internal company website (php instead of asp.net). The prod version of the website is at the 'Default Web Site' level and I've got demo and test versions of the website mapped as virtual directories. The demo and test version are essentially copies of the prod directory. I've noticed the with the web.config copied to these VDs, I get an error 500 on the root url for the VD only. I.E. main website is https://mainwebsite.com and works fine but https://mainwebsite.com/demo/ doesn't work while https://mainwebsite.com/demo/index.php works fine.
The web.config file is pretty basic:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
</handlers>
<defaultDocument>
<files>
<add value="index.php" />
</files>
</defaultDocument>
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="00:03:00" />
</staticContent>
</system.webServer>
</configuration>
Moving the web.config file out of the way in the VD resolves the issue. Even though the files are identical, I wouldn't think that the file should cause a conflict as my understanding is that IIS supports multiple web config files.
Although I have a workaround in place by renaming or deleting the file, I am wondering if there's a way to keep the file in place without it causing this error.
Thanks to Panama Jack in the comments, I was able to resolve my issue.
I got this response with detailed errors:
Error Summary
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
And further down:
Config Error
Cannot add duplicate collection entry of type 'add' with unique key attribute 'value' set to 'index.php'
To resolve, I simply commented out this line in the web.config XML:
<add value="index.php" />
I'm sure there's a better way to approach this but for now, this gets me my answer and also how to get more info from IIS when the logs are not useful.
if you create a virtual directory to another web root
web.config will cause this (personally I think the location of this file is totally insane.. mixed with htm and images etc. )
Replicate the directory somewhere else without the web.config file/excluding it..then point the virtual directory there.. & have a task set up to copy newer files over..

run processing.js on azure web sites

I made a projessing.js application. It works fine in localhost. However, when I deploy my project into my Azure website projessing.js is unable to find my sketch (.pde) file.This is the error message that I get from chrome's console ;
Uncaught Processing.js: Unable to load pjs sketch files: pde/Letter/Letter.pde ==> Invalid XHR status 404
I searched this problem and I found this post about it but I don't know how to make a configuration to my azure.This is the post that I found.I assume it is something related with permissions.
You will need to add the .pde MIME type to your IIS config (web.config file) in Azure. It will look something like the below XML block:
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".pde" mimeType="application/x-processing" />
</staticContent>
</system.webServer>
</configuration>
I'm not sure what the exact mime type is for that file, but the issue is that the MIME type isn't configured, and IIS will block unknown MIME types by default.

Are asp.net detailed error messages disabled on windows azure?

I have the simplist of web.config files and it works fine locally but on Windows Azure webs it doesnt show detailed errors ? Do they have them disabled on their services.
You cant get much simpler than this
<?xml version="1.0"?>
<configuration>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="false" targetFramework="4.0"/>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows"/>
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
-->
<customErrors mode="Off"/>
</system.web>
</configuration>
But yet I still get the yellow screen of death
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 <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> 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 <customErrors> 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>
This is most probably due to config file transformation that happens when you create and deploy package on Azure. Check you web.config file related to build configuration used for Azure deployment (mostly it is 'web.release.config') in your web project. There may be config transformation that are setting customErrors to value other than Off

SharePoint error

I have a Sharepoint site and today when I try to login to the site it gives me the following error
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've got to change this file:
You may also need edit the web.config in the layouts folder of the SharePoint root:
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\web.config
And set
<customErrors mode="Off" />
Change the following in web.config and you will be able to see the detailed error.
<customErrors mode="Off"/>
and
CallStack="true"
Make sure you do this in all the WFEs. You will see detailed error. Once you have the detail error, post it here and we will be able to helop you more.
Set the custom error mode to remote only in your web.config file and try browsing the site again. This time you will get the detailed error with the stack trace. You can proceed from there.
Restart your server then try... Because in my case during I install visual studio on my server system, i can't access my site and i got same error what you posted in above, after restarted my server its works fine. that's why i am saying like that...
What i thought is, actually that time the IIS was disturbed by some other installation program.

Resources