HTTP Error 500.19 and error code : 0x80070021 - asp.net-mvc
I have a simple webAPI build by Visual Studio 2013. It works well when I run it from VS13 but when I copy the project in local IIS it gives me the following error.
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 BeginRequest
Handler Not yet determined
Error Code 0x80070021
Config Error This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false".
Config File \?\C:\inetpub\wwwroot\APITeslin\web.config
Config Source:
36: <system.webServer>
37: <handlers>
38: <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
Got precisely the same error and came to this question. As #SpaceBison mentioned in comments, this answer describes the solution - https://stackoverflow.com/a/12867753/404099. I spotted it too late and it misses some steps. This is what worked for me:
Windows Server 2012, IIS 8.5. Should work for other versions too.
Go to server manager, click add roles and features
In the roles section choose: Web Server
Under Security sub-section choose everything (I excluded digest, IP restrictions and URL authorization as we don't use them)
Under Application Development choose .NET Extensibility 4.5, ASP.NET 4.5 and both ISAPI entries
In the features section choose: NET 3.5, .NET 4.5, ASP.NET 4.5
In the web server section choose: Web Server (all), Management Tools (IIS Management Console and Management Service), Windows Authentication - if you are using any of it
I got this error while trying to host a WCF service in an empty ASP.NET application. The whole solution was using .NET 4.5 platform, on IIS 8.5 running on Windows 8.1.
The gotcha was to
Open up "Turn Windows Features on or off"
Go to WCF section under ASP.NET 4.5 advanced services
Check HTTP Activation.
You'll be asked to restart the system.
This should Fix the HTTP 500.19!
EDIT 11-FEB-2016 Just got an issue on Windows 10 Pro, IIS 10, This time, it was an HTTP 404.0. The fix is still the same, turn on "HTTP Activation" under Windows Features -> .NET Framework 4.6 Advanced Services -> WCF Services -> HTTP Activation
I also was getting the same problem but after brain storming with IIS and google for many hours. I found out the solution.
This error is because some settings are disabled in IIS applicationHost.config.
Below are the steps to solution:
Go to C:\Windows\System32\inetsrv\config\applicationHost.config and open in notepad
Change the following key value present in
<section name="handlers" overrideModeDefault="Deny" /> change this value from "Deny" to "Allow"
<section name="modules" allowDefinition="MachineToApplication" overrideModeDefault="Deny" />
change this value from "Deny" to "Allow"
It worked for me.
If you're running IIS on that computer for the first time, you should try running the ASP.NET IIS registration tool (aspnet_regiis.exe).
Here's how to do that:
If you're using .net framework v4, open command prompt as an administrator, and change directory to your .net framework base folder using:
CD C:\Windows\Microsoft.NET\Framework\v4.0.30319
or, if you're using a 64 bit computer, use:
CD C:\Windows\Microsoft.NET\Framework64\v4.0.30319
when you've successfully navigated to the appropriate directory, execute the ASP.NET IIS registration tool using:
aspnet_regiis -i
If you're using a different .NET framework version, simply replace v4.0.30319 with the appropriate folder name.
Hope this helps.
I solved this by doing the following:
WebServer(ISS)->WebServer->Application Development
add .NET Extensibility 3.5
add .NET Extensibility 4.5
add ASP.NET 4.5
add ISAPI Extensions
add ISAPI Filters
On Windows 8.1, IIS 8.5 the solution for me was to register 4.5 from the control panel:
Programs and Features > Turn Windows features on or off > Information Information Services > World Wide Web Services > Application Development Features > Select ASP.NET 4.5
Click OK.
As the error idnicates - "This happens when the section is locked at a parent level". To unlock the section you can use appcmd.exe and execute the following command:
%windir%\system32\inetsrv\appcmd.exe unlock config -section:system.webServer/handlers -commitpath:apphost
For more information on about section locking and what a parent configuration context is refer to IIS documentation.
If it is windows 10 then open the powershell as admin and run the following command:
dism /online /enable-feature /all /featurename:IIS-ASPNET45
On Windows 8.1 or 10 include the .Net framework 4.5 or above as shown below
In our case, we struggled with this error for quite some days. It turns out that in control panel, programs, turn windows features on or off.
We selected Internet Information Services, world wide web services, Application development features and there we check the set of features associated with our development environment. For example: ASP.NET 4.6. .NET Extensibility 4.6, etc.
It works!
Try unlocking the relevant IIS (7.5) configuration settings at server level, as follows:
Open IIS Manager
Select the server in the Connections pane
Open Configuration Editor in the main pane
In the Sections drop down, select the section to unlock, e.g. system.webServer > defaultPath
Click Unlock Attribute in the right pane
Repeat for any other settings which you need to unlock
Restart IIS (optional) - Select the server in the Conncetions pane, click Restart in the Actions pane
In my case, there were rules for IIS URL Rewrite module but I didn't have that module installed. You should check your web.config if there are any modules included but not installed.
Your web.config describes that you're using forms authentication - make sure you enable forms authentication and disable anonymous authentication in IIS under the Authentication menu, for the website that is running in IIS.
I got Error Code 0x80070021 when migration IIS7 to IIS 10 in win 2016 box . .
Below steps helped me to fix it .
source
manually change value from "Deny" to "Allow" for below settings in
%windir%\system32\inetsrv\config\ applicationHost.config
under section:system.webServer
<section name="handlers" overrideModeDefault="Deny" />
Please <staticContent /> line and erased it from the web.config.
Well, we're using Amazon Web Services and so we are looking to use scripts and programs to get through this problem. So I have been on the hunt for a command line tool. So first I tried the trick of running
c:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i
but because I'm running a cloud based Windows Server 2012 it complained
This option is not supported on this version of the operating system. Administrators should instead install/uninstall ASP.NET 4.5 with IIS8 using the "Turn Windows Features On/Off" dialog, the Server Manager management tool, or the dism.exe command line tool. For more details please see http://go.microsoft.com/fwlink/?LinkID=216771.
and I Googled and found the official Microsoft Support Page KB2736284. So there is a command line tool dism.exe. So I tried the following
dism /online /enable-feature /featurename:IIS-ASPNET45
but it complained and gave a list of featurenames to try, so I tried them one by one and I tested my WebAPI webpage after each and it worked after the bottom one in the list.
dism /online /enable-feature /featurename:IIS-ApplicationDevelopment
dism /online /enable-feature /featurename:IIS-ISAPIFilter
dism /online /enable-feature /featurename:IIS-ISAPIExtensions
dism /online /enable-feature /featurename:IIS-NetFxExtensibility45
And so now I can browse to my WebAPI site and see the API information. That should help a few people. [However, I am not out of the woods totally myself yet and I cannot reach the website from outside the box. Still working on it.]
Also, I did some earlier steps following other people responses. I can confirm that the following Feature Delegation needs to be change (though I'd like to find a command line tool for these).
In Feature delegation
Change
'Handler Mappings' from Read Only to Read/Write
Change
'Modules' from Read Only to Read/Write
Change
'SSL Settings' from Read Only to Read/Write
Check if IIS server installed the URL rewrite feature.
If it is not installed then make sure your web.config file don't have the URL rewrite related configuration
<!-- Make sure don't have below config, if server have not installed url rewrite feature. -->
<rewrite>
<rules>
<rule name="Fail bad requests">
<match url=".*"/> ...
Some time we copied the config from legacy server and straight away deploy to brand new server, then we may encounter such kind of 500 issue.
Had this today on a Windows 2016 Core server I resolved the issue by ensuring the components were installed as mentioned by GIOESCOM and then I repaired the SDK's in my case for .NET Core 3.1, .NET 5 and .NET 6 which resolved the issue and the ASP.NET 4.7.2 MVC web app worked.
This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault=”Deny”)
Hello guys
From older IIS and server
We may encounter the following error when we want to run our application on IIS 10 built on the new Microsoft Windows Server 2016.
HTTP Error 500.19 – Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault=”Deny”), or set explicitly by a location tag with overrideMode=”Deny” or the legacy allowOverride=”false
The solution is very simple.
Follow the C:\Windows\System32\inetsrv\config file path from your computer. Change the overrideModeDefault=”Deny” part in the applicationHost config file to “Allow”. Then when you restart IIS, the problem will be fixed.
It works and save my time. Try it HTTP Error 500.19 – Internal Server Error – 0x80070021 (IIS 8.5)
The solution that worked for me was to delete my current Web.config and add a new one. That solved the problem for me
Related
Visual Studio 2017 - Giving remote users access to website in IIS Express
Been looking through and trying all guides i found on this topic but no luck. I am running and MVC project with HTTPS and want to access the debug site with some remote mobile devices to test out the website. I followed a guide that almost work and i think I am pretty close to getting it to work. Here are the steps I have done: Turn off Firewall Open projectfolder of website go to \vs\config\ and open applicationhost.config Find your site and line that contains your mapped port like this: -edit it to get this result: Tried to run Visual Studio as Admin at this point, Got regular error 400: Bad Request - Invalid Hostname when trying to access site from other computer Opened CMD as Admin and ran the following command: netsh http add urlacl url=http://*:44363/ user=everyone - URL reservation successfully added -Tried to start Visual studio as admin and non admin. Gets the following error message "Unable to launch the IIS Express Web Server. Failed to reister URL "https://localhost:44363" for site "x" Application. Error description: Cannot create file when that file already exists" -I then have to run cmd again and remove the url with the command: netsh http delete urlacl url=http://*:44363/ How do i get this to work with Visual Studio 2017 ? I cant be many steps from getting it to work. I have read many guides but none of them works
Amazing how such a simple common need can be so painful to fulfill out of the box in 2017! Anyway https://github.com/icflorescu/iisexpress-proxy worked nicely for me. Install it with node: npm install -g iisexpress-proxy Then its just something like: iisexpress-proxy 51123 to 3000 Under 2 mins to get running.
Let me share my experience with Visual Studio and IIS Express that should help you. I am not using HTTPS and my project type is Web site with WCF but you should be able to accomplish your goal. Here are prerequisites: IIS Express installed Visual Studio installed Added url reservation for public port (netsh http add url=http://*:50001/ User=Everyone) from elevated command prompt. Added firewall inbound rule for 50001 TCP port (Control Panel-->Windows Firewall-->Advances Settings-->Inbound Rules-->New Rule...) Now let us setup a project in VS. I am using one of predefined templates with C#. Compile it and try to run it from VS. At that moment VS is starting developer instance of IISExpress that helps your site to run. You should be able to see IIS Express icon in Notification area. With right click you will see that your site is running and a port (we will call it VSPORT) that is assigned by VS. This port must be different than reserved port (50001). If you managed to accomplish this without problems then you have almost everything ready for running your site without VS. Go to your project folder Go to .vs folder Go to config folder Open applicationhost.config Locate sites/your_site section Copy everything between your_site and /your_site Now we need to add this info in "global" IIS Express config. Go to IIS Express folder (something like c:\Users\USERNAME\Documents\IISExpress) Go to config folder Open applicationhost.config Locate sites section. Paste information about your site. Change binding from binding protocol="http" bindingInformation="*:VSPORT:localhost" to binding protocol="http" bindingInformation=":50001:" Save changes With this change you may start IISExpress.exe directly and you can continue to use VS to work on you project at the same time. If you want to access it from other computers do it as http://YOURIP:50001/. Do have in mind that you need to ensure that your javascript code is NOT using address and port number directly.
You can solve the problem by downloading the 'conveyor' library from extensions and update in Visual Studio. You can access it from other devices. Open Visual Studio Tools > Extensions and Updates Online > Visual Studio Marketplace Search 'Conveyor' Download and install this extension When you launch the API, you can access it from other devices. This plugin creates a link from your own ip address. Example: https://youripadress:5000/api/values
my local host in visual studio is going to a directory instead of the site now
I am not able to get the site working anymore. I don't know what happened but everytime I go to the site it starts giving me a file directory instead. How can I fix this? image of what im getting when I build the solution
Depending of your IIS version, these solutions should work: 1) Open web.config on your MVC root project (not on the Views directory) and check this element to be exist: <system.webServer> <modules runAllManagedModulesForAllRequests="true"/> </system.webServer> 2) Make sure your directory browsing for localhost server application pool set to "Disable" (IIS Manager - Features View - Directory Browsing - Disable, by default this property is Disable). See https://technet.microsoft.com/en-us/library/cc731109(v=ws.10).aspx for more details. Click "Test Settings" to verify virtual directory & path settings. 3) Check default route on your MVC project, then on publish mode set the project as IIS application. Make sure your site's default route has proper declaration. 4) For 64-bit host only (Win 7/Windows Server 2008 and above): Install 32-bit version of aspnet_regiis if your MVC application built on 32-bit platform. The 32-bit project should run on 32-bit environment without problems, some 32-bit app running directly on 64-bit machine using 32-bit registers may cause several oddities and compatibility issues. The issue can narrowed if you tell what IIS version installed on your machine (specifically includes 32-bit/64-bit platform) and MVC version to build your project.
Deploying a project to Internet Information Services (IIS) with .NET Framework V4
Not sure here , but i hope someone would direct to the right in publishing a project to IIS from visual studio. I'm publishing my project in .NET Framework V4. and on IIS I'm setting the Application Pool of the site to .NET Framework V4 as well. Now, for some reason when I go to the site link it does not work and gives the following error: *Server Error in '/' Application. The resource cannot be found. Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly. Requested URL:* / But when i change the Application Pool to .NET Framework V2 the site works but i really need it to be working with the Application Pool set to .NET Framwork v4. Is there anything i am missing? can someone direct please? Thank you
Maybe your .net Framework v4 ASP is not registered. open command prompt (Start -> cmd) and for 32 bit servers run the command %windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i open command prompt (Start -> cmd) and for 64 bit servers run the command %windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i And Check if all features are installed for IIS
Deploying ASP.NET Application on IIS7
I am developing an ASP.NET MVC 4.5 application in C#. It works flawlessly when I run it after compiling on my local IIS Express. However, when I try to upload it to a remote server it does not seem to recognize anything in its root directory. It only displays the default welcome screen. I have tried reconfiguring the web.config file to point to Global.asax file, without any success. I am able to load single images by modifying the URL according to the sites structure. What is the initial "starting file" on ASP.NET MVC 4.5 and how do I configure IIS7 to load it?
Check you server configuration (if possible), first enable Web Server (IIS) role (is posible to add from Server Manager or PowerShell), then install .NET Framework, or use aspnet_regiis.exe from .net framework folder (C:\Windows\Microsoft.NET\Framework\v4.0.30319 and C:\Windows\Microsoft.NET\Framework64\v4.0.30319) if server has configured iis web role and .net framework installed but configured incorrectly. If unsure what role features to add use Web PI and add IIS Recommended Configuration (http://www.microsoft.com/web/downloads/platform.aspx) Note: In Visual Studio 2012 project template for MVC 4 Web Application references as copy-local MVC Assemblies from NuGet and therefor you don't need to install MVC 4 on web server. Command to register current .NET version (from folder wich you are executing this utility, execute for both, first for 32-bit and than for 64-bit on 64-bit OS) with IIS: aspnet_regiis -i PowerShell to add Web Server role: PS> Import-Module ServerManager PS> Add-WindowsFeature Web-Server
If you see the default IIS welcome screen then it's probably because of incorrect website bindings (IP:port:hostheader). Whenever IIS cannot locate a website with specific binding it falls request back to "Default Web Site" with *:80 binding which you probably observe.
How to fix: Handler "PageHandlerFactory-Integrated" has a bad module "ManagedPipelineHandler" in its module list
I am configuring an MVC 3 project to work on a local install of IIS and came across the following 500 error: Handler "PageHandlerFactory-Integrated" has a bad module "ManagedPipelineHandler" in its module list. It turns out that this is because ASP.Net was not completely installed with IIS even though I checked that box in the "Add Feature" dialog. To fix this, I simply ran the following command at the command prompt %windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i If I had been on a 32 bit system, it would have looked like the following: %windir%\Microsoft.NET\Framework\v4.0.21006\aspnet_regiis.exe -i My question is, is there a way to install IIS on a windows 7 box to use .NET 4.0 (MVC 3) without taking this extra step?
It turns out that this is because ASP.Net was not completely installed with IIS even though I checked that box in the "Add Feature" dialog. To fix this, I simply ran the following command at the command prompt %windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i If I had been on a 32 bit system, it would have looked like the following: %windir%\Microsoft.NET\Framework\v4.0.21006\aspnet_regiis.exe -i Remeber to run the command prompt as administrator (CTRL+SHIFT+ENTER)
The accepted answer is correct, however sometimes you would get the "Aspnet_regiis.exe is not recognized as an internal or external command, operable program or batch file." error message. To resolve it try the following: Make sure that your .NET 4.0 installation is not corrupted (run the installer and 'Repair' it). There's also a chance it is not installed on your machine at all. If you're sure you don't have .NET 4.0 installed and want to run it as .NET 2.0, try this: If you see the message "Aspnet_regiis.exe is not recognized as an internal or external command, operable program or batch file.", switch to the C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Aspnet_regiis.exe -i at the command prompt.
Error: Handler “PageHandlerFactory-Integrated” has a bad module “ManagedPipelineHandler” in its module list I found the articles to fix this issue by simply run the following commands at the command prompt: %windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i If the system is 32 bit, it would have looked like this: %windir%\Microsoft.NET\Framework\v4.0.21006\aspnet_regiis.exe -i But, when I tried to execute these commands using a command prompt, I got the following error/warning message: C:\Windows\Microsoft.NET\Framework64\v4.0.30319>aspnet_regiis.exe -i Microsoft (R) ASP.NET RegIIS version 4.0.30319.33440 Administration utility to install and uninstall ASP.NET on the local machine. Copyright (C) Microsoft Corporation. All rights reserved. Start installing ASP.NET (4.0.30319.33440). This option is not supported on this version of the operating system. Administr ators should instead install/uninstall ASP.NET 4.5 with IIS8 using the "Turn Win dows Features On/Off" dialog, the Server Manager management tool, or the dism.exe command line tool. For more details please see http://go.microsoft.com/fwlin k/?LinkID=216771. Finished installing ASP.NET (4.0.30319.33440).** To fix this on a Windows 8.1, I would suggest to do the following thing. Solution: Goto: Turn Windows features on or off -> Internet Information Services -> World Wide Web Services -> Application Development Features -> Enable ASP.NET 4.5 This should resolve the issue.
To solve the issue try to repair the .net framework 4 and then run the command %windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i
I would also check the obvious first: that the application pool is set to the correct framework and that your IIS application actually points to the folder where you put your files
If you want to deploy an MVC application without installing MVC, you can deploy the MVC DLL's with your application. This gets around installing MVC 3. You can use features in some .Net 4.0 namespaces without installing .Net using a similar approach.
I added the ISAPI/CGI paths for .Net 4. Which didn't fix the issue. So I then ran a repair on the .Net V4 (Client and Extended) installation. Which asked for a reboot. This fixed it for me.
To fix this on a Windows 8.1 Professional machine do the following. Install the Web Platform Installer. http://www.microsoft.com/web/downloads/platform.aspx In Web Platform Installer install ASP.NET 4.5 (This feature has one dependency). If you simply try the aforementioned cmd prompt command from the most popular answer you will get the following error/warning message: C:\Windows\Microsoft.NET\Framework64\v4.0.30319>aspnet_regiis.exe -i Microsoft (R) ASP.NET RegIIS version 4.0.30319.33440 Administration utility to install and uninstall ASP.NET on the local machine. Copyright (C) Microsoft Corporation. All rights reserved. Start installing ASP.NET (4.0.30319.33440). This option is not supported on this version of the operating system. Administr ators should instead install/uninstall ASP.NET 4.5 with IIS8 using the "Turn Win dows Features On/Off" dialog, the Server Manager management tool, or the dism.e xe command line tool. For more details please see http://go.microsoft.com/fwlin k/?LinkID=216771. Finished installing ASP.NET (4.0.30319.33440).
I have tried to do aspnet_regiis in command prompt but I got answer that I don't have admin rights. Then, after some more googling and looking for a solution I tried to right click cmd and run it as an admin. Confirmed yes when dialog appeared, ran aspnet_iis again ant worked like a charm. In short: 1. check .NET framework in app_pool 2. run cmd as an admin 3. run aspnet_regiis -i
I had the same problem and my solution was: Go to "Turn Windows features on or off" > Internet Information Services > World Wide Web Services > Application Development Features >Enable ASP.NET 4.5
I had a similar issue with Windows server 2012, installing the feature "Application Server" in the server manager fixed the issue.
-Using application initalization feature -requesting wrong pages (.asp) because of config inheritance 500.21 will occur on the first user connection only. Subsequent connections work. Resolved by correcting the applicationInitialization url collection on the .NET website.
run cmd drag and drop Aspnet_regiis.exe into the command prompt from: C:\Windows\Microsoft.NET\Framework64\v2.0.50727\ type -i (for example Aspnet_regiis.exe -i) hit enter wait until the process completes Good luck!
I had this problem and found that removing the following folder helped, even with the non-Express edition.Express: C:\Users\<user>\Documents\IISExpress
None of these worked for me. So as I compared various app pools with one that worked vs one that didn't, I had to go into Advanced Settings for the App Pool, and set Enable 32-Bit Applications = true Then it worked fine!
I had the same problem, in my case handler was in two places: <system.web> ... <httpHandlers> <add verb="*" path="*.ashx" type="ApplicArt.Extranet2.Controller.FrontController, ApplicArt.Extranet2.Web.UI" /> </httpHandlers> </system.web> <system.webServer> <handlers> ... <add name="FrontController" verb="*" path="*.ashx" type="ApplicArt.Extranet2.Controller.FrontController, ApplicArt.Extranet2.Web.UI"/> </handlers> </system.webServer> And when I removed my handler from [system.webServer] my problem disappeared.
in some scenario this error occurs because the Microsoft .NET Framework 4.0 configuration for ASP .NET has been damaged, which can occur if Microsoft Visual Studio 2012 was installed before Visual Studio 2010 or Microsoft SQL Server 2008. After trying different things i reached the conclusion, repair you .Net installation by running following command. For more information follow the link. C:\Windows\Microsoft.NET\Framework64\v4.0.30319\SetupCache\v4.5.51209\setup.exe /repair /x86 /x64 /ia64 /norestart https://msdn.microsoft.com/en-us/library/hh168535(v=nav.80).aspx
To solve the issue try to repair the .net framework 4 and then run the command %windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i enter image description here
I was having this issue on one of my webservers when trying to switch an apppool from classic to integrated. It worked fine on two of my other webservers, not just this one. It's Server 2012, so you can't do the aspnet_regiis and there was no setupcache folder to try that repair. Everything was set correctly under features. After going through %windir%\system32\inetsrv\config\applicationHost.config I found one critical missing bit. Under my non-working one was missing the following two lines: <add name="ManagedEngineV4.0_32bit" image="C:\Windows\Microsoft.NET\Framework\v4.0.30319\webengine4.dll" preCondition="integratedMode,runtimeVersionv4.0,bitness32" /> <add name="ManagedEngineV4.0_64bit" image="C:\Windows\Microsoft.NET\Framework64\v4.0.30319\webengine4.dll" preCondition="integratedMode,runtimeVersionv4.0,bitness64" /> Once I added them, everything worked great.