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:
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.
The configuration files for IIS 7 and later are located in your %WinDir%\System32\Inetsrv\Config folder, and the primary configuration files are: ApplicationHost. config - This configuration file stores the settings for all your Web sites and applications.
In IIS Manager, in the Connections pane, select the site or application for which you want to configure permissions. On the home page for the site or application, double-click IIS Manager Permissions. On the IIS Manager Permissions page, in the Actions pane, click Allow User.
Select the ASP.NET Core project in Visual Studio Solution Explorer and click the Properties icon, or press Alt+Enter, or right-click and choose Properties. Select the Debug tab. In the Properties pane, next to Profile, For IIS Express, select IIS Express from the dropdown.
The root web. config of default web site is displayed in c:\inetpub\wwwroot. wwwroot folder is the root path of default web site. If it is not displayed, you could go to IIS manager and add a authorization rule.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With