“403 Access Forbidden” when attempting to create an ASP.NET web project


A few weeks ago I had one of those days…

I hosed my development environment, so that every time I attempted to create a new ASP.NET web application in VS.NET 2003, I would get the following error message:   The Web server reported the following error when attempting to create or open the Web project located at the following URL: ‘http://localhost/WebApplication1’.  ‘HTTP/1.1 403 Access Forbidden’.

I could create a web project in VS.NET 2002 without any problem (on the same machine).  Another fun note was that if I created the virtual directory first in IIS manager, and create a project in VS 2003 pointing to that vdir it would work.

I looked through the MSDN docs, through the news groups, etc., but couldn’t find a way to resolve the issue.

Turns out that I had somehow set my default web site’s Home Directory > Execute Permissions to None.  Once I changed it back to Scripts only, bingo.  VS.NET 2003 was happy.

So if you get a 403 Access Forbidden error message when attempting to create an ASP.NET web app in VS 2003, take a look at your execute permissions…

bliz


Comments (73)

  1. Valeriy says:

    Thanks for advise, it helped !!!

  2. jmatter says:

    VS 2003 must make the permissions change during the install(?). I wated 3 hours trying to fix this. Thanks!

  3. Tom Hanrath says:

    This works great. THANKS! (PS jmatter…just change the permissions now…it works)

  4. Nat says:

    Thank you for posting this, you saved me hours of time.

    For some odd reason the install took away execute permissions AND removed read permissions in IIS for the Default web site. Other people in my company with similar setups (Windows 2000 server, running .net 2002) did not have this happen after installing .NET 2003. Just my luck.

  5. GOGO says:

    You are the man! Damn M$!

  6. bliz says:

    Gogo: glad you were able to get it working! — bliz

  7. Vlad says:

    THANK YOU!!! IT IS SO SIMPLE BUT IT WASTED SO MUCH OF MY TIME UNTIL I FOUND YOUR POST. YOU SAVED ME FROM REINSTALLING EVERYTHING FROM SCRATCH.

  8. eswar says:

    Thank u.

  9. Colin says:

    excellent! I had the same issue, thanks

  10. bliz says:

    Hi Denisse, did you follow the steps I took above? If you’re having the same problem, that should fix it. If it doesn’t fix it, I’d recommend that you post the details of your problem to the newsgroup: microsoft.public.dotnet.framework.aspnet OR microsoft.public.vsnet.ide.

    Hope this helps,

    – bliz

  11. shiv says:

    Thanks for this post. it helped and saved my time to figure out the problem. I got this problem when i tried to impersonate stuff in machine config file and iis locked my a/c and reset some of other stuff too. I suggest somebody should post such simple answers to our common everyday problems involving VS. perhaps Microsoft should have a site dedicated to such problems.

    thanks anyway

  12. muadib says:

    Thanks for the help!

  13. Tony M says:

    I did try scripts only but got this error:

    The web was created successfully, but an error occurred when trying to configure the application root for this web. Web projects may not operate correctly without an application root. The returned error was: Active Directory services can not find the web server. A possible cause for this is an incompatibility between versions of Internet Information Server (IIS) on the client and the server. The usual cause for this error is creating web projects on a Windows 2000 or newer server from a Windows NT 4.0 client. You can manually configure the application root using the Internet Services Manager.

    I am not using NT on my development machine, it is XP Professional.

    But to resolve the error I went to the Windows 2003 server and did the following in IIS Manager:

    1) Right click on default website

    2) Select Properties

    3) Clicked on Home Directory tab

    4) under the Execute Permissions list, selected "Scripts and Executables"

    Clicked OK and it works like a charm.



    Tony

  14. bliz says:

    Tony: glad you were able to get it working.

    Farahmand: glad it help.

  15. Farahmand says:

    Thank you 😀

  16. Sam says:

    —————————

    Microsoft Development Environment

    —————————

    The Web server reported the following error when attempting to create or open the Web project located at the following URL: ‘http://localhost/WebApplication1‘. ‘A connection with the server could not be established’.

    —————————

    OK Help

    —————————

    I have script only execute permissions .. works fine in VS.NET however in VS.NET 2003 get that error

    Any Suggestions.

  17. bliz says:

    Sam,

    It could be a number of things. I’d recommend you do a search from msdn.microsoft.com, using the keywords "a connection with the server could not be established visual studio .net create project" or something to that effect.

    Hope this helps,

    bliz

  18. Ashutosh Bhalerao says:

    Thank you. Solved it for me.-Ashu

    I changed my application to use https and installed a server certificate. Source safe could not connect to the IIS server to download the latest version of the code. Maybe this might solve that problem as well.

  19. May says:

    Each time when I try to create a new ASP.NET web application in VS.NET 2003, I would get the following error message:

    The web server reporting the following error when attempting to create or open the web project located at the following URL:’http://localhost/vb/WebApplication1‘.’HTTP/1.1 500 server error’

    I looked through the MSDN docs, through the news groups, etc., but couldn’t find a way to resolve the issue.

  20. bliz says:

    Hi May,

    Hmmm. You could try repairing your VS .NET installation. Run the VS .Net setup and choose repair.

    Hope this helps… — bliz

  21. Faisal Mahmoud says:

    I had this same problem. But my root cause was that I had set the server to run on port 8080. I had another machine running an apache server on port 80, so I wanted my windows machine to run on a different port. I guess that didn’t work out so well when trying to setup a project.

    Anyone know a solution for this?

  22. pinky says:

    my problem is :The web was created successfully, but an error occurred when trying to configure the application root for this web. Web projects may not operate correctly without an application root. The returned error was: Active Directory services can not find the web server. A possible cause for this is an incompatibility between versions of Internet Information Server (IIS) on the client and the server. The usual cause for this error is creating web projects on a Windows 2000 or newer server from a Windows NT 4.0 client. You can manually configure the application root using the Internet Services Manager.

    same as tony’s. I already tried changing it to scripts and executables but still get the same error message…. one thing i observed though, when my network cable is plugged, i get the error otherwise it is working well, still puzzles me how can it be happening when i am trying to create a web application in the localhost and do not connect to other computers in the network. i just connect to the network to access internet. please help me. thanks.

  23. kar says:

    i did change the execute permissions, still i’m getting the same error. Could anyone please advise !

    Thanks

  24. Andrew says:

    pinky: try changing the location of the webservice (when you create it) from http://localhost/[webservicename] to http://127.0.0.1/[webservicename] or whatever ip address / name you specified the server to run on.

  25. What also helps this problem and the 500 Server Error problem is to run aspnet_regiis with the -i flag. this file should ne in the C:WinntMicrosoft.NETFramework<version> location. then you just run aspnet_regiis -i.

    -Drakier

  26. Thank you says:

    And thank you again. I was about to go mad here.

  27. mwhalen says:

    I’m having the problem with a solution that I’ve been working with for a couple of weeks now. It worked fine up until today and I don’t know what changed to make this happen. I’ve checked into everything that was suggested here. All of the settings are as they should be, but I still can’t get the project (actually projects, there’s 4 in the solution I’m working with). I’ve run aspnet_regiis -i, that didn’t help either.

    Any more suggestions? I’m running WinXP Pro, IIS 5, IE 6, and I have both VS.NET 2003 and VS.NET 2002 on my machine and the problem occurs in both. I can’t open any of the web projects that are on my machine.

  28. bliz says:

    mwhalen: Your best bet would be to post this type of question on one of the newsgroups, such as microsoft.public.dotnet.framework.aspnet. The newsgroups have experts in the particular area, and should be able to get you an accurate answer.

  29. terry says:

    Thank you, thank you, thank you…. did everything listed above, but kept getting same error. Final thing that worked was changing from http://localhost/webapp1 to http://192.168.1.10/webapp1 (my server IP on LAN). Even changing to 127.0.0.1 didn’t work, any ideas why? … it was working a few days ago, but I did run some security wizard that obviously locked things down too far.

  30. Paul says:

    Because I’m french, I say MERCI BEAUCOUP !

  31. AlanK says:

    Brilliant!

    Im using VS.NET 2003, IIS 5, and XP SP1 and setting permissions on default web site to Scripts fixed this problem.

    Cheers

    Al

  32. Alex Rosales says:

    Cool… 3 hours, and i find your response! Thanx

  33. Dean says:

    I had the same symptoms as the problem you have experienced, however, my settings were already set to Scripts Only. After re-installing IIS and running aspnet_regiis I still had the problem. I was only able to fix it by changing the anonymous user of the Default Web Site to a more privelaged user than the default. Thought I’d post my findings here, as this blog appears top when searching for the answer.

    Cheers,

    Dean

  34. bliz says:

    Hi Dean,

    You shouldn’t have to run with elevated permissions. I’d keep looking for the root cause if I were you. Don’t rely on elevated permissions.

    If you develop your app using elevated privileges, when you move to a test or production environment your app may break. During development you may unknowingly program your app to take advantage of the elevated privileges. And you won’t find out until you put it on a box that runs as ASPNET with lower permissions.

    bliz

  35. "403 Access Forbidden" when attempting to create an ASP.NET web project

  36. B.Zomer says:

    Maybe a tip. I had tryed tips above. They did not work. The problem was i used SSL. I turned it off en now it works.

    B.Z

  37. Pramod says:

    Thanks this helped!!!!!!!!!!

  38. Debbi says:

    YOU ARE A LIFE/TIME SAVER. thanks for sharing your information!!!!!

  39. David L says:

    cheers

  40. JAM says:

    My setting were correct and it still failed. I restarted IIS and that fixed it.

  41. Vandan says:

    Bliz,

    ur suggestions helped but i also had to check the Read & Write under Home Directory in IIS as they were unchecked for some reason. Also used Microsoft KB for the same.

    http://support.microsoft.com/default.aspx?scid=kb;EN-US;160754

    Keep the good work

    – Vandan

  42. hardik says:

    i got an error in web access through IIS service in windows XP kindly give me solution on hardik_sis@yahoo.com

  43. PG says:

    I was getting this problem, but only when IE was set up to go via a proxy server. I found that somehow all the settings in Tools | Connections | LAN Settings | Advanced | Do not use proxy server for addresses beginning with: had been removed. Putting back "localhost" here fixed the problem.

  44. bliz says:

    PG: good info! Thanks for sharing!

  45. HellRazer says:

    I also had 403 error but my cause was different:

    the installer put the default page (IIS>defaul page>yoursite -> property’s -> documents tab)

    to default.aspx instead of my project’s start page

    chnaging this to the correct start page fixed the problem

  46. Tomas from CZ says:

    Thanks, it works very well

    I cannot understand why this help cannot be found on microsoft websites…

  47. Emil says:

    Was having same problem HTTP/1.1 403. Followed your advice, but it now shows error HTTP/1.1 500 Server Error. Tried to reinstall everything, first IIS 5.1 then Visual Studio, but still no luck, same problem. Someone suggested to run a special command from a command line, but I don’t know what the full version no for asp 1.1? Could you suggest? Thanks Emil/.

  48. bliz says:

    Try this:

    Using IIS, create a virtual directory. Create a simple ASPX page. Try to open the page in Internet Explorer. If you still get a 500 error, turn off friendly HTTP error messages in Internet Explorer (Tools | Options | Advanced. Uncheck "Show friendly HTTP error messages.")

    If that doesn’t shed some light, I’d Google on the terms 500 Server Error Visual Studio .NET.

    Hope this helps.

  49. Jason says:

    yet another "thank you"!

  50. mao says:

    god bless ya

  51. wiching says:

    It really works

  52. JBoy says:

    Getting this error (or similar) ?…

    The web server reported the following error when attempting to create or open the web project located at the following URL: ‘http://localhost/WebApplication1‘. ‘HTTP/1.1 500 Server Error’.

    Try turning your personal firewall completely off. Like totally unload the mofo.

    Just a thought.

  53. James says:

    Hi

    I’ve been getting the same HTTP/1.1 500 error when i tried to create a new project.

    Could it be to do with the fact that i installed php for iis ???

    James

  54. jack says:

    wheeeewwwww! thanks a lot!

  55. bliz says:

    > Could it be to do with the fact that i installed php for iis?

    I’m not familiar with PHP or what it does during the installation. You may want to Google for that.

  56. bliz says:

    > Try turning your personal firewall completely off.

    You may want to try that just to see if it gets rid of the 500 error. But I wouldn’t run that way for long, and you probably should disconnect from the network to be safe from intruders while you do it. (My 2 cents.)

    There’s probably some other root cause than the personal firewall.

  57. James says:

    no firewall mate

    that’s the thing, i really don’t get why this happens.

  58. James says:

    it would be really interesting if someone could explain how visual studio actually attempts to create a virtual directory in the root folder when a new project is created. That might help us pin point some strange errors.

  59. Chk says:

    I have the same error when I try to reopen the VS.NET project. We developed the project without SSL and then we configured the website to use SSL. After doing that when we try to open the project in VS.NET it gives Access Forbidden error. Website directory properties has scripts only. What will be the problem?

  60. rahmetleah says:

    Thanks it helped

  61. Def J says:

    w/VS.net 2003-

    Error message was still appearing after setting the execute permissions to something other than ‘none’.

    Error message also appeared when attempting to connect to a VDIR.

    Changing the location from

    (BAD)

    http:\localhostWebApplication1

    to

    (GOOD)

    http:\[server IP address]WebApplication1

    prevented the error message and allowed the "WebApplication1" subdirectory to be created within the home directory.

    Thank you Andrew for posting this information.

    Thanks to Bliz for starting this excellent thread about this wacked problem.

  62. Ponnurangam says:

    This works great. THANKS!

  63. Hi Guys,

    Thanks for the above tips…

    After setting Execute permission to Scripts only at the Virtual Directory settings, Check the Read option also in the properties(This is just above the Directory Browsing option)..that worked great on my system..then u dont need to set your IP Address also…thanks

  64. shai says:

    Thanks , you make my day

  65. Gabriel "brainman" Blum says:

    My solution:

    Check if default.aspx is set as default page. If not, IIS tries to browse directory, which usually doesn’t have permission.

    Adding default.aspx as default page solved for me

  66. ferha says:

    I created a Web Application in Visual Studio .NET. I can access an aspx page from a .NET program (C#) successfully, but when I try accessing it using WinHttp, I get the 403 error. Any idea about which library I should be using to access an aspx page through VB?

  67. ferha says:

    I forgot to mention – I tried changing the permissions as described above, changed the URL from localhost to the actual IP address (I’m trying it from my own machine), but nothing seems to work. My development m/c is Windows XP

Skip to main content