You do not have permission to access the IIS configuration file - Web app error - asp.net

I am trying to load existing c# web applications and getting below errors while loading any web project:
Creation of the virtual directory http://localhost:/ failed with the
error: You do not have permission to access the IIS configuration
file. Opening and creating web sites on IIS requires running Visual
Studio under an Administrator account.. You will need to manually
create this virtual directory in IIS before you can open this
project.
The following error occurred when trying to configure IIS Express for
project xxx.WebApi. You do not have permission to access the IIS
configuration file. Opening and creating web sites on IIS requires
running Visual Studio under an Administrator account.
I tried following, but in vain:
Running VS 2017 pro as an administrator.
I ensured that I have access to %systemroot%\System32\inetsrv\ and C:\Windows\System32\inetsrv\Config folders.
I have installed all IIS compatibility windows features through control panel.
Restarted IIS manager.
Created virtual directories.
Changed registry path of HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Personal from u:\ to C:\Users\MyUser\Documents.
Uninstalled IIS Express 10.0 from control panel and reinstalled it through VS2017 installer by clicking – Individual components – cloud, database server – IIS Express.
Repaired VS 2017.
Got admin access on machine.
Created new empty web project but getting same error while new console app runs without errors.
Restarted machine after every installation related change.
All the solutions tried are mentioned on stackoverflow but are not working for me. Is there something trivial that I am missing? Please guide me to crack these IIS errors.

I was able to solve this issue doing the following:
1- Go to C:\Windows\System32\inetsrv and double click on directory config and accept the warning message.
2- Go to C:\Windows\System32\inetsrv\config directory and double click on directory Export and accept the warning message.
Then you will be able to run the app in your local IIS without being an administrator. You can follow the path in the given Image.

This solved the problem for me with Visual Studio 2017, .Net Core 2.2 and IIS Express 10.
You need to ensure devenv.exe has sufficient permissions. You can find it at:
C:\Program Files OR Program Files (x86)\Microsoft Visual Studio nn.n\Common7\IDE
Right click on the exe, select Properties, Security. I gave Administrators full control as I'm running VS under admin.

My Simple solution was to right click on Visual Studio and click Run as Administrator. But a solution above tells you how to have Visual Studio always run without having to run as an administrator.

All these solutions could not work for me. The issue was, I have accidently uninstall IIS from control panel even it was install and showing me. but was removed from control panel. I reinstall IIS latest version and able to fixed the problem. This might help for others.
This link help me
VS2017 RC - The following error occurred when trying to configure IIS Express

The issue for me was caused when I modified my project to override application root URL. After a push/merge and new branch my project would not load any longer. reverted the changes and all is well again.

Open an elevated command prompt and enter the following command to substitute a drive path for U drive.
c:\windows:\system32> Subst u: C:\Users\MyUser\Documents
I had replaced ‘U:’ path in registry with ‘C:\Users\MyUser\Documents’ previously. I think that was not sufficient. Some references of u:\ might have been hindering IIS.
The total substitute command must have replaced all references and the IIS config error got resolved. Hopefully, now I’ll be able to load my web apps.

I had the same issue, but instead of the workarounds (such as first double-clicking certain directories each time or running the security risk of always having to always run my VS as administrator), was able to permanently resolve the issue by deleting the "ProjectName.csproj.user" file and that fixed it. I guess there was some incompatible setting in the user file that VS couldn't deal with.

For older versions, change the option from IIS to your solution name, before clicking on the green play like run button, to build and run the application.

We resolved this by removing the project and adding it back.

If you're used to run your Visual Studio via shortcut with 'Run as administrator' checkbox marked, double check it is indeed still selected. For some reason mine had unchecked itself resulting in inability to load an IIS project. I was 100% sure my VS had these administrative privileges as usual, which made me try all the Internet proposed solutions except for the most obvious one.

Restarting Visual Studio worked for me.

Related

Can't run IIS Express from VS2015

I've made everything like it has been described here. But when I started my Visual Studio project - it said: "Unable to launch the IIS Express Web server". The start URL specified is not valid. http://dev.local/". By the way, I can launch it, using cmd ("run as administrator", ofc):
> iisexpress /site:WebApiLocal
So, whats the problem? Where am I wrong?
P.S. Visual Studio has been launchedwith admin's rights.
Ok, I had found solution. I've used local applicationhost.config, which placed in {SolutionDir}.vs\config directory. So, if you have the same problem, check this file or go to the {UsersProfileDirectory}\Documents\IISExpress\config and edit applicationhost.config. Also, you can edit in .csproj tag UseGlobalApplicationHostFile saying to project what kind of applicationhost you want to use:
<UseGlobalApplicationHostFile>True</UseGlobalApplicationHostFile>
Thanks everybody for ideas!
This can happen if you use an external program (e.g. git) and accidentally delete the applicationhost.config file. A restart of visual studio recreated the file in my case, and it started working again.
According to other posts, Visual Studio 2015 specifically requires the site bindings to use localhost as host name. No matter what posts show you that you can otherwise modify the config, the modification just works under command line but not in VS.
Either Microsoft patches VS later in an update, or you revert your manual changes.
I meet the same issue after I enable remote requests in IIS Express. to solve this, you have to remove the urlacl you set before.

Unable to access the IIS metabase ASP.Net

Hi I know there are a few threads on this but none of the solutions seem to work for me.
I have an ASP.Net website project which I am trying to load and publish in Visual Studio. However when I load the project I get the error:
Creation of the virtuald directory http://localhost:xxxx failed with
the error: Unable to access the IIS metabase. You do not have
sufficient privilege to access IIS web sites on your machine.
This error only occurs when I run Visual Studio as Administrator. If I don't run as admin then the above error does not occur but when I try to publish my app I get:
Please launch Visual Studio under administrator mode to perform this
deployment action
It seems I can't win!
What I've tried so far:
Taking ownership of C:/Windows/System32/Inetsrv/Config
Setting <UseIISExpress>false</UseIISExpress> in my project_name.csproj file
Go back to and old team foundation server check in that didn't have the problem in admin mode and use that configuration.
Running Visual Studio as non-admin (works but note second error above)
None had any luck so far.
Extra Info:
Operating System: Windows 8.1 (64 bit)
Visual Studio: 2013
IIS: 8.5
Permissions on C:\Windows\System32\inetsrv\config (read only):
Me: Full control
Administrators: Full control
Permissions on Documents/IISExpress/config (read only):
Me: Full control
Administrators: Full control
Note "Documents" is on a network drive
It turns out my Personal Folder was set to a network drive which occasionally went down causing the error described.
To change your Personal folder:
Open C://Windows/regedit.exe
Navigate to HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders
Change the field Personal to %USERPROFILE% or %USERPROFILE%\{a folder of your choice}
This fixed the problem for me.
Note you may need to move over any files from your old Personal folder to your new one as they wont be picked up any more
Have you tried the following fix ?
Here is the Fix that worked.
"I think we encountered a similar problem at work. For us, the solution was to go into Control Panel -> Programs and Features -> Turn Windows Features on or off... inside that, we had to select Internet Information Services -> Web Management Tools -> IIS 6 Management Compatibility -> IIS Metabse and IIS 6 configuration compatibility.
https://social.msdn.microsoft.com/Forums/en-US/1d5cb9c7-af77-4bcd-8421-e813aff88bd3/help-with-visual-studio-2012-error-unable-to-access-the-iis-metabase?forum=visualstudiogeneral
I had the same problem after I mistakenly Cut and Pasted my Documents, Downloads and Desktop folders to my external hard drive, it changed the path of the folders to the F: drive (the external hard drive), I copied the folders back and set the path back to local.
Copy the items back to C:\Local Disk\Users\your_name
Right click on the folder (that isn't working) and click Properties
e.g Documents
Click on the Location Tab
Change the location to normal e.g C:\Local Disk\Users\your_name\Documents
This is what worked for me :D
Maybe a shot in the dark - but have you tried installing the 'IIS Management Console', 'IIS Management Scripts and Tools' and 'IIS Management Service' from Add/Remove Programs - Turn Windows Features On or Off? That may help.
Left click on your project --> properties. Select WEB. Check the link [port] on project url. Click Create Virtual Directory. Should help.
Step 1: Close if Visual Studio Opened.
Step 2: Open Project Folder and find ".vs" folder, it may be hidden
Step 3: Delete ".vs" folder
Step 4: Open Project Again

Unable to access the IIS metabase

An ASP.NET web project loads with up the solution, but I get this error
The Web Application Project is configured to use IIS. Unable to access the IIS metabase. You do not have sufficient privilege to access IIS web sites on your machine.
How can this be solved?
This may have nothing to do with registering ASP/IIS. The reason is exactly what the error message says: Visual Studio devenv.exe is not running with sufficient privileges to access the IIS process, and it needs to do this if your solution contains a web project whose Web settings say to use IIS rather than the VS dev server.
There are two solutions to your problem:
Run VS as an Administrator and reopen the solution/project.
Edit the web application's project file with a text editor and change this line
from True to False:
<UseIIS>True</UseIIS>
That will stop it using IIS and demanding higher privileges.
The reason VS demands Admin privileges is, I believe, because it will try and create the IIS web site for you on demand if it doesn't exist.
An answer that worked for me can be found here:
https://stackoverflow.com/a/17460774/3005965
Basically, go to %systemroot%/inetsrv/config. When prompt appears saying you need admin privileges, click Continue.
This should clear up your issue.
Just try to access Visual studio as Admin right click and choose run as administrator.
may fixes this problem.
and take a look at this link for instructions on creating a shortcut.
I ran into this problem when I had copied a project to a new project. I opened the project file (.csproj) and removed the value from the IISUrl element:
from: <IISUrl>http://localhost:21222</IISUrl>
to: <IISUrl></IISUrl>
Have you registered the .NET framework with IIS? You need to run the aspnet_regiis.exe utility found at %WindowsDir%\Microsoft.NET\Framework\vx.y.zzzz\. Run it as administrator as follows:
aspnet_regiis.exe -i
-i : Installs the version of ASP.NET that is associated with Aspnet_regiis.exe and updates the script maps at the IIS metabase root and below. Only the script maps for applications that use an earlier version of ASP.NET are updated. Applications that use a later version are not affected.
Find out more about the utitlity here.
This error also occurs if you modified your Machine.config and added some "invalid lines":
For example, I added some appSettings, to the configuration section (which IIS didn't like).
Just register your Web-project in your local IIS. All the settings you will find in *.csproj file. That works for me.
first uncheck internet information service from turn windows features on or off.
then uninstall iis from your system and restart it. after restarting it install iis again from https://www.microsoft.com/en-us/download/confirmation.aspx?id=34679 and try to open again.
Step 1: Close Visual Studio
Step 2: Go to Project Folder and find ".vs" folder Note: It may be hidden
Step 3: Delete ".vs" folder
Step 4: Open Project Again

Debugging ASP.NET in IIS 7

I have searched all the usual but come up empty. I must be doing something silly!
Simply I created a new project, ASP.NET Web App, and wish to use and debug it with the local install of IIS 7.5 on my Windows 7 x64 box.
According to what I have read it should be a simple process; my issue is that Visual Studio will not stop at breakpoints nor at errors etc.
I just don't get it:
Visual Studio is attaching to the w3p process for me automatically.
If I hover over the breakpoints it shows a message saying the same, that it is in the same w3p process.
I am in Administrator context. I manually ran it like so to be sure but in any case if you are an admin it runs like that anyway.
Some notes:
I do not wish to use IIS Express as I require native IIS 7.5 for my tasks, however it does debug in express - no surprise there.
As mentioned above, all this is being done locally.
The path of the virtual directory is pointed towards the project files, as set by Visual Studio 2010. It even set the Network Service as read on the folder structure.
When debugging from VS the web site runs fine, just debugging is the issue.
Maybe it is permissions? The Default App Pool is using the ApplicationPoolIdentity not Network Service... Should it be? I had assumed they we.re one and the same essentially. Although I changed this and no luck unless I didn't do something I should of
Keep in mind here that my issue is semi-unique in that I am not receiving error messages, not even in the event logs... For all intents and purposes it should be working fine, just it isn't.
VS and IIS, and all updates, are applied to date.
Note: I'm familiar with IIS7.5, I run my own public web hosting server. I just never tried to debug
Note: It is Visual Studio 2010 Ultimate
Thanks for your time.
Sigh!
I went back to basics... Uninstalled IISExpress and tested; It worked! Re-installed IISExpress; It worked!.
I guess installing IIS7 native after IISExpress did something screwy? I had ran the register ISS command on IIS7 when I installed it.
Right, so now I have both installed in tandem and they work fine. Thanks for all your help guys, appreciated.
you can try right-click on project in VS go to properties select web from left menu tab. Check if ASP.NET debugger is checked and also you can select Use Local IIS Server and give localhost url there (in project Url textbox) and then Say start debugging from VS and put breakpoints.
I had a similar issue the other day, I attached the debugger to the wrong w3p process, make sure you attach it to the one the app pool identity is running under.
I wanted to write it as comment by I don't think I can add pictures..
Are you sure you are running the same version of dll?
Is your breakpoint filled like this?
or hollow like this?
1st go to ,Program and Feature in control panel and then in that turn on or off windows features. and now check all check boxes(activate features) related to Internet Information server & windows service managers. once this is done run your visual studio as administrator and then attach to right w3p process.

Unable to find script library WebUIValidation.js

Hi having some problem with a webserver and some webpages on it, everytime they refresh a popup with this error displays:
Unable to find script library '/aspnet_client/system_web/1_1_4322/WebUIValidation.js'. Try placing the file manually, or reinstall by running 'aspnet_regiis -c'
There are hundreds of answers on google with the following solutions:
1. Run aspnet_regiis -c
2. Replace or copy the file/folders manually
but what to do when the above doens't work.
This webapplication I'm running is using dot.net 1.1 and is located under Default Web Site/App Name/. A aspnet_client directory exist below that virtual directory and contains the WebUIValidation.js file, the aspnet_client directory also lies in the c:\inetpub\wwwroot.
The server is a webserver/sql server, win 2003 IIS 6.
Microsoft dot.net framework 1.1,2.0,3.0,3.5 seems to be installed(Add or Remove programs).
I suspect there is some problem with having all these dot.net version.
Any help is highly appreciated.
I just ran into this problem as well. Plenty of posts listed solutions that didn't work for me. What did work was to check the "Integrated Windows Authentication" on the website node (Right click Web Site -> Properties -> Directory Security) in the IIS 6 manager. It's strange to me that something that had been running fine for years, had this problem all of the sudden.

Resources