Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 472
P Deshpande Avatar asked May 21 '19 07:05

P Deshpande


People also ask

How do I access IIS configuration file?

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.

Where is IIS Manager permissions?

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.

How do I enable IIS Express in Visual Studio 2017?

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.

Where is the web config file in IIS 10?

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.


3 Answers

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.

enter image description here

like image 197
jordenysp Avatar answered Oct 13 '22 23:10

jordenysp


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.

like image 4
Dwain B Avatar answered Oct 14 '22 00:10

Dwain B


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.

enter image description here

like image 3
Eddie Avatar answered Oct 14 '22 00:10

Eddie