建立开发环境ASP.NET MVC [英] Setting up development environment for ASP.NET MVC

查看:99
本文介绍了建立开发环境ASP.NET MVC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从PHP背景来的。我用了Apache,MySQL和PHP的Web开发。
我刚开始asp.net mvc的。

I'm from PHP background. I used to use Apache, MySQL and PHP for web development. I'm just starting asp.net mvc.


  1. 我有Visual Studio 2008的专业版SP1的&安培; .NET 3.5 SP1已经安装在我的电脑上。

  2. 所以,我安装的 ASP.NET MVC 1.0

  3. 创建一个ASP.NET MVC Web应用程序项目

  4. 当我打F5它提供了错误的无法连接到ASP.NET开发服务器

  1. I've Visual Studio 2008 Pro SP1 & .NET 3.5 SP1 already installed on my computer.
  2. So, I installed ASP.NET MVC 1.0
  3. Created a "ASP.NET MVC Web Application" project
  4. 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.

我可以在这里使用的Apache?我想IIS是默认的。它在哪?如何配置呢?什么是IIS服务器的Web根目录的目录?我在哪里可以找到它?

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?

在搜索无法连接到ASP.NET开发服务器我发现这个解决方案:

On searching for "Unable to connect to the ASP.NET Development Server" I found this solution:

第1步:选择工具 - >外部
  工具,在VS或Visual Web菜单选项
  开发人员。这将允许你
  配置和添加新的菜单项目
  您的工具菜单中。

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.

第二步:点击添加按钮添加
  一个新的外部工具菜单项。名称
  它Web服务器在端口8010(或
  其他任何你想要的)。

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).

第三步:在命令文本框
  设定输入该值:
  C:\\ WINDOWS \\ Microsoft.NET \\框架\\ V2.0.50727 \\ WebDev.WebServer.EXE
  (注:此指向Web服务器
  这通常VS自动运行)。

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).

第4步:对于参数文本框
  设置输入该值:/端口:8010
  /路径:$(PROJECTDIR)(或任何端口,你
  等等)

Step 4: For the "Arguments" textbox setting enter this value: /port:8010 /path:$(ProjectDir) (or any port you like)

第五步:选择使用输出窗口
  复选框(这将prevent的
  从弹出的命令shell窗口。

Step 5: Select the "Use Output Window" checkbox (this will prevent the command-shell window from popping up.

一旦你点击应用和确定你会
  现在有一个新的菜单项的
  工具菜单被称为Web服务器上的端口
  8010。现在,您可以选择任何网页
  项目在解决方案中,然后
  选择此菜单选项来启动
  有一个根站点的Web服务器
  端口8010(或任何其他端口您
  想),用于该项目。然后,您可以
  连接到这个网站在浏览器中通过
  只是说的http://本地主机:8010 /
  所有基于根引用将工作
  精细。

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.

步骤6:最后一步是配置
  Web项目自动
  当您运行引用此Web服务器
  或调试一个网站,而不是推出
  内置的web服务器本身。去做
  这一点,请在你的web项目
  Solution Explorer中,点击鼠标右键,
  选择属性页。选择
  启动选项左边设置,
  并在服务器上更改电台
  从默认键的值(
  在使用内置的Web服务器),而不是
  是使用自定义服务器。然后设置
  基本URL值是:
  的http://本地主机:8010 /

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/

但没有 C:\\ WINDOWS \\ Microsoft.NET \\框架\\ V2.0.50727 \\ WebDev.WebServer.EXE 我的系统上这样的文件。难道我忘了安装的东西?请帮我在经营我的Hello World应用程序。

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.

编辑:

我使用的是Windows XP SP2和身份登录与管理previlages用户。

I'm using Windows XP SP2 and logged in as a user with Administrative previlages.

此<一个href=\"http://stackoverflow.com/questions/990033/unable-to-connect-to-asp-net-development-server-issue\">http://stackoverflow.com/questions/990033/unable-to-connect-to-asp-net-development-server-issue


      
  • 禁用IPv6

  •   

完成!


      
  • 确保心不是在主机的编辑文件的本地主机

  •   

有在我的hosts文件中没有任何一个条目(%SYSTEMROOT%\\ SYSTEM32 \\ DRIVERS \\ ETC \\主机)在它的'localhost'。

There is no single entry in my hosts file (%SystemRoot%\system32\drivers\etc\hosts) with 'localhost' in it.


      
  • 检查防火墙/病毒设置允许从devenv.exe的
  • 来/连接
      
  • Check firewall/virus settings to allow connections to/from devenv.exe

我试图通过禁用防火墙/杀毒软件

I tried by disabling the firewall/antivirus


      
  • 如果您可以在$在浏览器p $ PVIEW确保浏览器的URL使用作为ASP.NET开发服务器任务栏图标显示的端口号相同的端口号。

  •   

没有,其实没有这样的dev的服务器任务栏图标。

No, Actually there is no such dev server taskbar icon.


      
  • 尝试在项目属性设置固定,predefined端口

  •   

试了一下。但是,没有阳性结果。

Tried it. But no positive result.

解决方案:

乱投医后。我来的结论,即WebDev.WebServer.exe可能已损坏。所以,我把它换成 C:\\ Program Files文件\\ Common Files文件\\微软共享\\ DevServer \\ 9.0 \\ WebDev.WebServer.EXE 有一个新的副本:的 http://www.4shared.com/file/116555696/ff3b0dc8/WebDevWebServer.html

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

它的工作! :)

推荐答案

ASP.NET开发服务器是随Visual Studio的一个小型的Web服务器。我们的想法是,你会不会需要设置IIS进行开发。

ASP.NET Development Server is a mini web server that comes with Visual Studio. The idea is that you wouldn't need to set up IIS for development.

此结账<一个href=\"http://stackoverflow.com/questions/990033/unable-to-connect-to-asp-net-development-server-issue\">question可能的解决方案。主要是我想确保本地主机是不是在您的主机文件重定向还,你没有做任何事情时髦与本地防火墙应用程序,可能会在localhost上阻止某些端口。

Checkout this question for possible solutions. Mostly I would make sure that localhost is not redirected in your hosts file and also that you are not doing anything funky with a local firewall app that might be blocking certain ports on localhost.

您不能,据我所知,使用Apache。你可以将其配置为将其指向你已经设定了一个有效的IIS目录在项目属性 - >启动选项屏幕上使用IIS。

You cannot, as far as I am aware, use Apache. You could configure it to use IIS in your project Properties->Start Options screen by pointing it to a valid IIS directory you have set up.

编辑:
也试试这个:

Also try this:


  1. 打开命令窗口(CMD.EXE)

  2. 运行C:\\ Program Files文件\\ Common Files文件\\微软共享\\ DevServer \\ 9.0 \\ WebDev.WebServer.Exe /端口:8080 /路径:C:\\ mywebpath \\(换出C:\\ mywebpath的路径,您的应用程序)

您应该注意Webdev的服务器在任务栏启动。然后,您应该能够浏览到的http://本地主机:8080 / Default.aspx的(或任何你页)。

You should notice the WebDev server start up in your task bar. You should then be able to browse to http://localhost:8080/default.aspx (or whatever your page is).

如果不工作,做同样的事情,但使用 http://127.0.0.1:8080/ Default.aspx的。如果这个工作,但本地主机不那么东西重定向本地主机的流量。

If that doesn't work try the same thing but using http://127.0.0.1:8080/default.aspx. If this works but localhost does not then something is redirecting your localhost traffic.

这篇关于建立开发环境ASP.NET MVC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆