17

I just reinstalled IIS7.5 after a lot of ugly messing around. I admittedly had no idea what I was doing.

I finally was able to renamed my windows\system32\inetsrv folder so that when I reinstalled IIS, I would get the default settings.

I took a wild guess at running this and it got my site running: aspnet_regiis.exe -i

Now I just can't Publish from Visual studio to any site under wwwroot.

for example, I get the error: Unable to create the Web site location 'c:\inetpub\wwwroot\WebApplication5'. Access is denied.

My work around is to Publish elsewhere and then copy the code there--and that works.

Goodness knows what else I broke in the process, but my web site appears to work except that I can't use the Publish functionality in VS2010 because of the Access Denied error.

Do I have to grant some ASPNET built in user rights to this folder?

Here's a snapshot of the rights on my wwwroot folder:

enter image description here

raven
  • 18,004
  • 16
  • 81
  • 112
Chad
  • 23,658
  • 51
  • 191
  • 321

6 Answers6

29

If you are able to run your application after copying from a different location, the problem is not with IIS or the worker process; it would most likely be a permissions problem with your windows user and process (in this case, visual studio).

Try running visual studio as an administrator (if you are not a local administrator of the machine). If that works, you can give full access to your inetpub folder for your user.

feathj
  • 3,019
  • 2
  • 22
  • 22
  • 2
    Running VS as an Administrator work. Then I granted my account full control of that folder and ran VS normally. That worked too. The thing that is stumping me is that my account absolutely IS in the Admin group. I'll give u screen shots for proff if you want them. Any idea? – Chad Jun 08 '11 at 05:09
  • Same problem here with VS publishing locally. – Dave Jul 20 '16 at 02:29
7

Late to this thread but I fixed this issue by going to:

c:\inetpub\wwwroot\myApplication > right click > properties > security > select Users(myMachine\Users) change access to full

Sonic Soul
  • 23,855
  • 37
  • 130
  • 196
  • hmm i've also noticed that sometimes this error happens intermittently, so possibly some resource access race condition – Sonic Soul Oct 04 '16 at 18:46
3

Hopefully this thread is still alive. I had this problem and here is how I resolved it:

Try opening a file on the remote site from Visual Studio by File>Open File...

If you don't have access you will be challenged with Windows Sign in. Here you can enter your credentials for accessing the REMOTE site. Once you enter the credentials and the file is successfully opened you will be able to publish. Occassionally (I don't know why) the credentials will become invalid at which time all you have to do is open a file and reenter them.

Alet
  • 31
  • 1
1

Another solution is to create a share to your local c:\inetpub\wwwroot dir (give yourself read/write permissions) and publish to the share like so: \\mypc\wwwroot\mywebsite. It helped me get around the annoying UAC security without disabling it.

goku_da_master
  • 4,257
  • 1
  • 41
  • 43
  • This was my preferred solution as it allowed me to follow the same process for publishing to a local iis directory on my development PC as well as when publishing to a remote server. Being able to retain the UAC security without disabling was a bonus since it is one less thing that needs to be modified / documented. – nbstrat Nov 30 '20 at 15:58
0

Web Deploy is likely to execute under the user name Local Service. Check the permissions for this user.

Johan Franzén
  • 2,355
  • 1
  • 17
  • 15
0

I'm having a similar problem

Access to the path 'C:\Sources\x\bin\Debug\netcoreapp2.1\publish' is denied. Unable to create the Web site location Access is denied.

Access is denied because a subfolder is open in file explorer and locked by file explorer.

Ozan BAYRAM
  • 2,780
  • 1
  • 28
  • 35