ChatGPT解决这个技术问题 Extra ChatGPT

Web Application Problems (web.config errors) HTTP 500.19 with IIS7.5 and ASP.NET v2

This is driving the whole team crazy. There must be some simple mis-configured part of IIS or our Web Server, but every time we try to run out ASP.NET Web Application on IIS 7.5 we get the following error...

Here's the error in full:

HTTP Error 500.19 - Internal Server Error

The requested page cannot be accessed because the related configuration  
data for the page is invalid.

`Detailed Error Information` 
Module              IIS Web Core
Notification        Unknown
Handler             Not yet determined
Error Code          0x8007000d
Config Error
Config File         \\?\E:\wwwroot\web.config
Requested URL       http://localhost:80/Default.aspx
Physical Path 
Logon Method        Not yet determined
Logon User          Not yet determined
Config Source
   -1: 
    0: 

The machine is running Windows Server 2008 R2. We're developing our Web Application using Visual Studio 2008.

According to Microsoft the code 8007000d means there's a syntax error in our web.config -- except the project builds and runs fine locally. Looking at the web.config in XML Notepad doesn't bring up any syntax errors, either. I'm assuming it must be some sort of poor configuration on my part...?

Does anyone know where I might find further information about the error? Nothing is showing in EventViewer, either :(

Not sure what else would be helpful to mention...

Assistance is greatly appreciated. Thanks!

UPDATES! - POSTED WEB.CONFIG BELOW

Ok, since I posted the original question above, I've tracked down the precise lines in the web.config that were causing the error.

Here are the lines (they appear between <System.webServer> tags)...

    <httpHandlers>
        <remove verb="*" path="*.asmx"/>
        <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=f2cb5667dc123a56"/>
    </httpHandlers>

Note: If I delete the lines between the <httpHandlers> I STILL get the error. I literally have to delete <httpHandlers> (and the lines inbetween) to stop getting the above error.

Once I've done this I get a new 500.19 error, however. Thankfully, this time IIS actually tells me which bit of the web.config is causing a problem...

    <handlers>
        <remove name="WebServiceHandlerFactory-Integrated"/>
        <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory,System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=f2cb5667dc123a56"/>
        <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=f2cb5667dc123a56"/>
        <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=f2cb5667dc123a56"/>
    </handlers>

Looking at these lines it's clear the problem has migrated further within the same <system.webServer> tag to the <handlers> tag.

The new error is also more explicit and specifically complains that it doesn't recognize the attribute "validate" (as seen on the third line above). Removing this attribute then makes it complain that the same line doesn't have the required "name" attribute. Adding this attribute then brings up ASP.NET error...

Could not load file or assembly 'System.web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=f2cb5667dc123a56' or one of its dependencies. The system cannot find the file specified.

Obviously I think these new errors have just arisen from me deleting the <httpHandlers> tags in the first place -- they're obviously needed by the application -- so the question remains: Why would these tags kick up an error in IIS in the first place???

Do I need to install something to IIS to make it work with them?

Thanks again for any help.

WEB.CONFIG

Here's the troublesome bits of our web.Config... I hope this helps someone find our problem!

<system.Web>

<!-- stuff cut out -->

    <httpHandlers>
        <remove verb="*" path="*.asmx"/>
        <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=f2cb5667dc123a56"/>
        <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=f2cb5667dc123a56"/>
        <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=f2cb5667dc123a56" validate="false"/>
    </httpHandlers>
    <httpModules>
        <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=f2cb5667dc123a56"/>
    </httpModules>
</system.web>

<system.webServer>
    <validation validateIntegratedModeConfiguration="false"/>
    <modules>
        <add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=f2cb5667dc123a56"/>
    </modules>
    <remove verb="*" path="*.asmx"/>
    <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=f2cb5667dc123a56"/>
    <handlers>
        <remove name="WebServiceHandlerFactory-Integrated"/>
        <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory,System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=f2cb5667dc123a56"/>
        <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=f2cb5667dc123a56"/>
        <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=f2cb5667dc123a56"/>
    </handlers>
</system.webServer>
Remove all the comments in the web.config. They begin with <!-- and end with -->.
woot. it's something to do with
Just replaced the httphandlers and httpmodules sections in my web.config and everything works fine. Thanks!
Your suggestion led me to start randomly deleting sections of web.config until the error changed and that helped me home in on the fact that URL ReWrite wasn't installed correctly (had to reinstall) so the section was causing the 500.19.
FYI, I had this error too... and it was just because .Net Framework wasn't installed on the server.

D
David Ferenczy Rogožan

I had these exact symptoms and my issue was similar to Peter's. Was setting up an existing project on a new server. My project referenced the IIS7 URL Rewriting module, but that hadn't been installed yet on the new server. Installing it fixed my issue.

You can use the Microsoft Web Platform Installer to install it. Execute it, select Products, in the left menu select Server and find URL Rewrite in the list and install it.

Or you can download it here.


> I had these exact symptoms and my issue was similar to Peter's. Was setting up an existing project on a new server. My project referenced the IIS7 URL Rewriting module, but that hadn't been installed yet on the new server. Installing it fixed my issue. Thanks, DJjeffJ. Fixed it for me. URL rewirte module on dev server not installed.
4 years on and this is still a problem. There is absolutely nothing in the error to provide any lead on the source of the problem. I too was moving an existing solution to a new server that did not yet have the module on and it was only by chance I stumbled across this answer so thanks a bunch as I was tearing my hair out!
The problem continues with Server 2016, there is no feature/module to install that says "URL Rewrite". You must use the to install it, and after that my site worked (or at least stopped giving that issue).
8 years on and this is still a problem. Thanks for this great answer @JJMpls
C
Chuck Le Butt

Aha! I beat this problem! My god, it was a beast for someone like me with limited IIS experience. I really thought I was going to be spending all weekend fixing it.

Here's the solution for anyone else who ever comes this evil problem.

First thing to be aware of: If you're hoping this is your solution, make sure that you have the same Error Code (0x8007000d) and Config Source (-1: 0:). If not, this isn't your solution.

Next thing to be aware of: AJAX is not properly installed in your web.config!

Fix that by following this guide:
http://www.asp.net/AJAX/documentation/live/ConfiguringASPNETAJAX.aspx

Then, install the AJAX 1.0 extensions on your production server, from this link:

http://www.asp.net/ajax/downloads/archive/ Update: Microsoft seems to have removed the above page :(

That's it!


thanks! The AJAX Extensions was the problem. I commented that section out since AJAX is now built into 3.5
Looks like Microsoft broke that first link to configure ASP.NET AJAX.
Found a mirror of the old content. So annoying the way MS documentation disappears so frequently.
Your answer suggests that this error is ONLY for Ajax but it applies to urlrewrite also which means the error likely just refers to any suggestion which is dependant on a module that's not available.
@Chuck, What does "I feel like Rocky" mean?
k
kerrydewhirst

After battling with this for a day on a new machine I came across the following links. I was missing the rewrite modules. This fixed everything.

http://forums.iis.net/t/1176834.aspx

http://learn.iis.net/page.aspx/460/using-the-url-rewrite-module/


+1. The web.config I grabbed from TFS had <rewrite> tags but I didn't have urlrewrite installed. I commented out the <rewrite> stuff and my site compiled and loaded up right away.
it took an hour to remember I used rewrite in the site. I wish microsoft had a better compiler error messages system. I would solve the issue in minutes if I would see the exact line of the web.config.
How do you install Url Rewrite in Visual Studio for IIS Express?
R
Rob

Same issue on Server 2016, IIS 10, 500.19 error. I installed the redirect module and it worked. I do not know why this was not included by default.

https://www.iis.net/downloads/microsoft/url-rewrite#additionalDownloads

To be clear it looks like the web.config from IIS 7 will work, or is designed to work, but the lack of this module gives the really odd and unhelpful error. Googling takes you to a Microsoft page which insists that your site is corrupted or your web.config is corrupted. Neither seems to be the case.

That unhelpful page is here: https://support.microsoft.com/en-us/kb/942055


T
The Edge

Had the same problem as above, same error code etc. Setting up a local website on Windows 8. After much searching it was found that we were missing URL rewrite. After downloading it everything was fine. :)


Man you saved me a lot of time... Nice!!
Similar, this error message is completely unhelpful!
G
Guillaume86

I just add an answear because I spent hours trying to solve the same symptoms (but different issue):

A possible cause is a x86 dll in a 64 bits app pool, the solution is to enable 32 bits apps in the application pool settings.


This answer is valid for the 500.19 error during setting up Umbraco CMS as well.
q
quetzalcoatl

Another way of getting 500.19 errot for no apparent reason is - missing directories and/or broken permissions on them.

In case of this question, I believe the question asks about full IIS version. I assume this because of this line:

Config File         \\?\E:\wwwroot\web.config

IIS installer usually creates the wwwroot for you and that's the default root folder for all websites and mount point for virtual directories. It always exists, so no problem, you usually don't care much about that.

Since web.config files are hierarchical, you can put there a master web.config file and have some root settings there, and all sites will inherit it. IIS checks if that file exists and tries to load it.

However, first fun part:

This directory will exists if you have IIS properly installed. If it does not exist, you will get 500-class error. However, if you play with file/directory permissions, especially 'advanced' ones, you can actually accidentally deny IIS service account from scanning/reading the contents of this directory. If IIS is unable to check if that wwwroot\web.config exists, or if it exists and IIS is not able to open&read it - bam - 500-class error.

However, for full IIS it is very unlikely. Developers/Admins working with full IIS are usually reluctant regarding playing with wwwroot so it usually stays properly configured.

However, on IIS Express..

Usually, IIS Express "just works". Often, developers using IIS Express often are not aware how much internally it resembles the real IIS.

You can easily stumble upon the fact that IIS Express has its own applicationHost.config file and VS creates and manages it for you (correctly, to some extent) and that sort of an eye-opener telling you that it's not that simple and point-and-click as it seems at first.

Aside from that config file, VisualStudio also creates an empty directory structure under your Documents folder. If I remember correctly, IIS Express considers these folders to be the root directories of your website(s) upon which virtual directories with your code are mounted.

Later, just like IIS, when IIS Express starts up, it expects these folders to exist and checks for root web.config files there. The site web.config files. Almost always, these web.config files are missing - and that's OK because you don't want them - you have your **application web.config", they are placed with rest of the content in a virtual directories.

Now, the second fun part is: IIS Express expects that empty directories. They can be empty, but they need to exist. If they don't exist - you will get a 500-class error telling you that "web.config" file at that path cannot be accessed.

The first time I bumped into this problem was when I was clearing my hard drive. I found that 'documents\websites' folder, full of trash, I recognized several year-old projects I no longer work on, all empty, not a single file, so I deleted it all. A week later - bam - I cannot run/debug any of the sites I was working at the moment. Error was 500.19, cannot read config file.

So, if you use IIS Express and see 500-class error telling about reading configuration, carefully check the error message and read all paths mentioned. If you see anything like:

c:\users\user\documents\visual studio 2013\projects\WebProject1\WebProject1.web\web.config
c:\users\zeshan.munir\documents\visual studio 2015\projects\WebProject1\WebProject1.web\web.config
c:\users\zeshan.munir\documents\visual studio 2017\projects\WebProject1\WebProject1.web\web.config
etc..

Go there exactly where the error indicates, ensure that these folders exist, ensure that IIS worker account can traverse and read them, and if you notice that anything's wrong, maybe it will be that.

BTW. In VisualStudio, on ProjectProperties/Web there's a button "Create Virtual Directory". It essentially does this very thing, so you may try it first, but IIRC it can also somethimes clear/overwrite/swap configuration sections in applicationHost.config file, so be careful with that button if you have any custom setups there.


c
ctc

For me, re-registering asp.net for iis did the trick. Hopefully that helps someone else.

aspnet_regiis.exe -i

M
Mark Sowul

To sum up based on answers here and elsewhere:

Check the .NET version of the app pool (e.g. 2.0 vs 4.0) Check that all IIS referenced modules are installed. In this case it was the AJAX extensions (probably not the case these days), but URL Rewrite is a common one.


K
Kyle

The below config was the cause of my issue:

    <rewrite>
      <rules>
        <clear />
        <rule name="Redirect to HTTPS" stopProcessing="true">
          <match url="(.*)" />
          <conditions>
            <add input="{HTTP_HOST}" pattern="^.*spvitals\.com$" />
            <add input="{HTTPS}" pattern="off" ignoreCase="true" />
          </conditions>
          <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" />
        </rule>
      </rules>
    </rewrite>

Note: I removed this section for local testing, as it works fine in Azure.


You can keep the rewrite rules in IIS if you install the IIS URL Rewrite module. It's at iis.net/downloads/microsoft/url-rewrite
d
demonicdaron

In my case, there was something wrong with the .NET Core Windows Hosting Bundle installation.

I had that installed and had restarted IIS using ("net stop was /y" and "net start w3svc") after installation, but I would get that 500.19 error with Error Code 0x8007000d and Config Source -1: 0:.

I managed to resolve the issue by repairing the .NET Core Windows Hosting Bundle installation and restarting IIS using the commands I mentioned above.

Hope this helps someone!


This worked for me as well, here is a MSDN blog about installing .NET Core Windows Server Hosting bundle: blogs.msdn.microsoft.com/rohithrajan/2018/03/13/… Here is a link directly to the download: aka.ms/dotnetcore-2-windowshosting
A
Avinor

This lovely detailed error is still present in 2019! I just want to add that if your web.config is valid and accessible it most likely is a dependency issue.

As mentioned by the OP it was a AJAX module, and as by others commonly the Rewrite module. Just keep your eyes open in your web.config what modules and libraries your tags are referencing to since the error code 0x8007000d can be about ANY dependency.

In my case I didn't realize the AspNetCore bundle was missing and had to be installed! So happy I found this post!!


a
anand shukla

This error is related to web.config file. When web.config is not proper or using some features which is not available in IIS, then this issue will come. In my case, I forgot to install URLRewrite module and was referencing it in web.config. It took some time to find the root cause. I started removing sections one by one and checked, only then i was able to find out the actual issue.


This was a huge help, thank you! I was about to start hacking up my web.config as well. This saved a lot of time.
t
tigrou

I had exact same error message with IIS10 and Windows 10. I tried everything listed here (and other internet pages as well) but it did not fixed it. What solved the issue was to install .NET Core Hosting a second time (I choose "Repair" button).

I'm 100% confident this is what fixed it because I had to deploy the same website to other laptops as well (different brands but all Windows 10). The same error message (500.19) occurred and reinstalling bundle fixed it again.


I had the same issue. Reinstalling the .NET Core Hosting Bundle did the trick.
t
tbone

This may or not be related....I started off with the same error mentioned above, started googling, making changes, getting new errors, endless loop.

The change that got me by that error was messing with the Feature Delegation in IIS Manager under the Management section of the server. I'm sorry I can't remember which one I changed, but googling might help.

That got me past the 1st error into a whole new stream of others, some totally nonsensical. (I would get one error when running under a virtual directory, converting it to an application yielded another error, etec etc). What finally solved this series of errors was: IIS manager, Application Pools, DefaultAppPool, Enable 32-Bit applications=True

I had started this app on a 32 bit windows xp box, and I am now running it on a 64Bit Windows 7 box.

So hopefully this helps someone else.


K
Konstantin

My IIS 7.5 does not understand tag in web.config In VS 2010 it is underline that tag also. Check your config file accurate to find all underlined tags. I put it in the comment and error goes away.


s
stealthyninja

Comment the following lines in the web.config file.

<modules>
    <!--<add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>-->
</modules>

<handlers>
    <remove name="WebServiceHandlerFactory-ISAPI-2.0"/>
    <!--<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    <add name="ScriptResource" verb="GET" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>-->
</handlers>

This will work.


J
Joel Peltonen

I had the same error. I had an IIS site with .net framework version 2.0, but my app needed 4.0. I changed the version and it worked.

Posting just as a reminder if someone might have the same issue.


C
Colin

Make sure all of your IIS features are properly enabled.

Open Windows Features (Turn Windows features on or off).

Scroll down to Internet Information Services

Open the World Wide Web plus box drop down

Open the Application Development Features plus box drop down

Manually check all of the subsequent check boxes, then click ok

https://i.stack.imgur.com/bdIVA.png


I had just reinstalled Windows 10 with the in-place upgrade method, and either I had unticked some of those boxes or the reinstallation unticked them. The associated error code 0x80070021 appeared on the 500.19 page.
B
BuzzCloudAU

I had the same issue in Windows 7.

The solution was to go to basic settings > connect as > specific user - and log in as a user, instead of the default 'pass-through'

This fixed the issue for me.


A
Alan10977

Windows 7

Try this,

run cmd as Admin.

Unistall all iis.

start /w pkgmgr.exe /uu:IIS-WebServerRole;WAS-WindowsActivationService

Reinstall iis and normaly it's work

Alain


f
foldinglettuce

I got this error by putting the <customErrors> tag inside of <system.webServer> instead of <system.web> where it belongs. There was a little squiggle under the <customErrors> tag but I didn't notice it right away.


n
notracs

Similar to the top answer, we were getting this incredibly unhelpful exception because of a missing IIS CORS module. It was the exact same error with Error Code (0x8007000d) and Config Source (-1: 0:), but installing the URL Rewriting module didn't fix it.

We had recently updated the web.config to enable CORS for some developers that needed it, but did not expect it would be required for all developers to install the IIS CORS module. Unfortunately it looks like it is required.

To fix it, install the IIS CORS module from here.


A
ADM-IT

If you are deploying asp.net.core application you also must install .net core hosting bundle. https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/index?view=aspnetcore-3.0#install-the-net-core-hosting-bundle


关注公众号,不定期副业成功案例分享
Follow WeChat

Success story sharing

Want to stay one step ahead of the latest teleworks?

Subscribe Now