I'm from PHP background. I used to use Apache, MySQL and PHP for web development. I'm just starting asp.net mvc.
- I've Visual Studio 2008 Pro SP1 & .NET 3.5 SP1 already installed on my computer.
- So, I installed ASP.NET MVC 1.0
- Created a "ASP.NET MVC Web Application" project
- when I hit F5 it gives error Unable to connect to the ASP.NET Development Server
No wonder. In this process I didn't setup the webserver.
Can I use apache here? I guess IIS is the default. Where is it? How do I configure it? What is the WebRoot directory for IIS server? Where can I find it?
On searching for "Unable to connect to the ASP.NET Development Server" I found this solution:
Step 1: Select the “Tools->External Tools” menu option in VS or Visual Web Developer. This will allow you to configure and add new menu items to your Tools menu.
Step 2: Click the “Add” button to add a new external tool menu item. Name it “WebServer on Port 8010” (or anything else you want).
Step 3: For the “Command” textbox setting enter this value: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\WebDev.WebServer.EXE (note: this points to the web-server that VS usually automatically runs).
Step 4: For the “Arguments” textbox setting enter this value: /port:8010 /path:$(ProjectDir) (or any port you like)
Step 5: Select the “Use Output Window” checkbox (this will prevent the command-shell window from popping up.
Once you hit apply and ok you will now have a new menu item in your “Tools” menu called “WebServer on Port 8010”. You can now select any web project in your solution and then choose this menu option to launch a web-server that has a root site on port 8010 (or whatever other port you want) for the project. You can then connect to this site in a browser by simply saying http://localhost:8010/. All root based references will work fine.
Step 6: The last step is to configure your web project to automatically reference this web-server when you run or debug a site instead of launching the built-in web-server itself. To-do this, select your web-project in the solution explorer, right click and select “property pages”. Select the “start options” setting on the left, and under server change the radio button value from the default (which is use built-in webserver) to instead be “Use custom server”. Then set the Base URL value to be: http://localhost:8010/
But there is no C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\WebDev.WebServer.EXE
such file on my system. Did I forget to install something? Please help me in running my "Hello World" application.
EDIT:
I'm using Windows XP SP2 and logged in as a user with Administrative previlages.
from this http://stackoverflow.com/questions/990033/unable-to-connect-to-asp-net-development-server-issue
- Disable IPv6
Done!!
- Make sure there isnt an edit in the hosts file for localhost
There is no single entry in my hosts file (%SystemRoot%\system32\drivers\etc\hosts) with 'localhost' in it.
- Check firewall/virus settings to allow connections to/from devenv.exe
I tried by disabling the firewall/antivirus
- If you can preview in the browser make sure the URL in the browser uses the same port number as the port number shown in the ASP.NET dev server taskbar icon.
No, Actually there is no such dev server taskbar icon.
- Try setting a fixed, predefined port in project properties
Tried it. But no positive result.
Solution:
After trying everything. I came to conclusion that WebDev.WebServer.exe may be corrupt. So, I've replaced C:\Program Files\Common Files\microsoft shared\DevServer\9.0\WebDev.WebServer.EXE
with a fresh copy : http://www.4shared.com/file/116555696/ff3b0dc8/WebDevWebServer.html
It worked!! :)