使用IIS运行ASP.NET应用程序的问题

时间:2020-12-28 03:34:58

I have written a small ASP.NET application. It runs fine when running it with the small IIS installation that comes with Visual Studio 2005, but not when trying with IIS. I created the virtual directory in IIS where the application is located (done it though both IIS and VS 2005), but it does not work. In the beginning I thought it might be caused by the web.config file, but after a few tests, I think that the problem lies with IIS (not certain about it).

我写了一个小的ASP.NET应用程序。使用Visual Studio 2005附带的小型IIS安装运行它时运行正常,但在尝试使用IIS时却没有。我在IIS中创建了应用程序所在的虚拟目录(通过IIS和VS 2005完成),但它不起作用。在开始时我认为它可能是由web.config文件引起的,但经过几次测试后,我认为问题在于IIS(不确定)。

Some of the errors that I get are

我得到的一些错误是

Unable to start debugging on the web server. The underlying connection was closed: An unexpected error ocurred on a receiver. Click help for more information

无法在Web服务器上启动调试。底层连接已关闭:接收器发生意外错误。单击帮助以获取更多信息

Can anybody give me a suggestion of what to try next?

任何人都可以给我一个下一步尝试的建议吗?

7 个解决方案

#1


6  

Have you run aspnet_regiis?

你运行aspnet_regiis了吗?

Here's an overview site for different IIS versions setup and should help if there are other questions/issues

这是一个针对不同IIS版本设置的概述网站,如果还有其他问题/问题应该会有所帮助

#2


1  

Try reinstalling aspnet_regiis.exe.

尝试重新安装aspnet_regiis.exe。

If you are using .net frameworkype 4.0 and using 64 bit system,

如果您使用.net frameworkype 4.0并使用64位系统,

Go to Run, Type cmd and Command Prompt will be up, then type

转到“运行”,键入cmd,命令提示符将启动,然后键入

%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i

If you are using 34 bit system,

如果您使用的是34位系统,

Go to Run Type cmd and then type

转到“运行”键入cmd,然后键入

%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i

#3


0  

The site won't load at all or you can't debug remotely?

该站点根本不会加载,或者您无法远程调试?

#4


0  

Some thoughts:

  1. Make sure you've got debugging enabled in your web.config, if you're trying to debug. Otherwise, build in 'Release' mode.
  2. 如果您正在尝试调试,请确保在web.config中启用了调试功能。否则,建立“发布”模式。

  3. Make sure your project is set as an application, and is running as the correct version of .NET
  4. 确保您的项目设置为应用程序,并作为正确的.NET版本运行

  5. More description of your setup and the error message would be useful.
  6. 您的设置和错误消息的更多描述将是有用的。

#5


0  

Make sure that the customErrors is set to off in the web.config. That should show the actual exception.

确保web.config中的customErrors设置为off。这应该显示实际的例外。

Make sure that your virtual directory in IIS is set to the correct version of the .NET framework.

确保IIS中的虚拟目录设置为.NET框架的正确版本。

Look at the properties in the virtual directory and see that the correct default documents are the ones that you are using in your dev project.

查看虚拟目录中的属性,并查看正确的默认文档是您在开发项目中使用的文档。

Also look at the url headers for the website in IIS.

另请查看IIS中网站的网址标题。

#6


0  

On some of our servers we have both versions of the .NET framework. In IIS I typically have to set what version the virtual directory should be using. This can cause problems running it on the server.

在我们的一些服务器上,我们有两个版本的.NET框架。在IIS中,我通常必须设置虚拟目录应使用的版本。这可能会导致在服务器上运行它时出现问题。

#7


0  

First make sure you have installed and configured IIS server. To check whether IIS server is installed: Run->inetmgr press enter. To know how to install and configure IIS server check the following Link: http://chalaki.com/install-iis6-windows-xp-professional-sp3-setup-run-csharp-cgi/425/

首先确保已安装并配置IIS服务器。要检查是否安装了IIS服务器:运行 - > inetmgr按enter键。要了解如何安装和配置IIS服务器,请检查以下链接:http://chalaki.com/install-iis6-windows-xp-professional-sp3-setup-run-csharp-cgi/425/

To develop Website using Visual developer with IIS instead of "default ASP.NET Development Server", In the new website window under "Location" click on "Browse" to see the different Server options including IIS Server. User can select the server as IIS server instead of "File System", then the "Location" option will be "HTTP" instead of "File System".

要使用Visual开发人员使用IIS而不是“默认的ASP.NET开发服务器”开发网站,请在“位置”下的新网站窗口中单击“浏览”以查看包括IIS服务器在内的不同服务器选项。用户可以选择服务器作为IIS服务器而不是“文件系统”,然后“位置”选项将是“HTTP”而不是“文件系统”。

In Visual developer 2008 under Properties->Start Option->Server->"Use local IIS server" option is not shown, Even though IIS server was installed and configured successfully. the only options shown are "use default server" and " Use custom server with base URL".

在Visual Developer 2008中的Properties-> Start Option-> Server - >“Use local IIS server”选项未显示,即使IIS服务器已成功安装和配置。显示的唯一选项是“使用默认服务器”和“使用带有基本URL的自定义服务器”。

So in Visual developer 2008 to run on IIS server(If IIS server is installed), Need do the following:

因此在Visual developer 2008中要在IIS服务器上运行(如果安装了IIS服务器),需要执行以下操作:

New Website -> Under Locations Click on "Browse" -> Click on "Local IIS" and then select the "IIS Virtual Directory"(IIS vitual Directory which is directory created by the user while configuring IIS server) -> Open

新网站 - >在地点下单击“浏览” - >单击“本地IIS”,然后选择“IIS虚拟目录”(IIS虚拟目录,这是用户在配置IIS服务器时创建的目录) - >打开

While Running/debugging, the server which you selected while creating the website, the same server will used to open the website, that is while creating the website if you selected "IIS Server" then the website will be opened though IIS server.

在运行/调试时,您在创建网站时选择的服务器,同一服务器将用于打开网站,即在创建网站时,如果您选择“IIS服务器”,则网站将通过IIS服务器打开。

One more thing is, while installing Visual developer 2008 and IIS server, If you installed IIS server after installing Visual studio then you need to do the following before creating new website:

还有一件事是,在安装Visual developer 2008和IIS服务器时,如果在安装Visual Studio之后安装了IIS服务器,那么在创建新网站之前需要执行以下操作:

Run ->cmd press enter (then enter the following Command)-> C:\WINDOWS\Microsoft.NET\Framework\Version# aspnet_regiis -i press Enter then you get message after 3 seconds "ASP.net was installed successfully". (*Version# will be v2.0.50727 in most cases)

运行 - > cmd按回车键(然后输入以下命令) - > C:\ WINDOWS \ Microsoft.NET \ Framework \ Version#aspnet_regiis -i按回车键,然后在3秒后收到消息“ASP.net安装成功”。 (*大多数情况下版本号为v2.0.50727)

#1


6  

Have you run aspnet_regiis?

你运行aspnet_regiis了吗?

Here's an overview site for different IIS versions setup and should help if there are other questions/issues

这是一个针对不同IIS版本设置的概述网站,如果还有其他问题/问题应该会有所帮助

#2


1  

Try reinstalling aspnet_regiis.exe.

尝试重新安装aspnet_regiis.exe。

If you are using .net frameworkype 4.0 and using 64 bit system,

如果您使用.net frameworkype 4.0并使用64位系统,

Go to Run, Type cmd and Command Prompt will be up, then type

转到“运行”,键入cmd,命令提示符将启动,然后键入

%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i

If you are using 34 bit system,

如果您使用的是34位系统,

Go to Run Type cmd and then type

转到“运行”键入cmd,然后键入

%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i

#3


0  

The site won't load at all or you can't debug remotely?

该站点根本不会加载,或者您无法远程调试?

#4


0  

Some thoughts:

  1. Make sure you've got debugging enabled in your web.config, if you're trying to debug. Otherwise, build in 'Release' mode.
  2. 如果您正在尝试调试,请确保在web.config中启用了调试功能。否则,建立“发布”模式。

  3. Make sure your project is set as an application, and is running as the correct version of .NET
  4. 确保您的项目设置为应用程序,并作为正确的.NET版本运行

  5. More description of your setup and the error message would be useful.
  6. 您的设置和错误消息的更多描述将是有用的。

#5


0  

Make sure that the customErrors is set to off in the web.config. That should show the actual exception.

确保web.config中的customErrors设置为off。这应该显示实际的例外。

Make sure that your virtual directory in IIS is set to the correct version of the .NET framework.

确保IIS中的虚拟目录设置为.NET框架的正确版本。

Look at the properties in the virtual directory and see that the correct default documents are the ones that you are using in your dev project.

查看虚拟目录中的属性,并查看正确的默认文档是您在开发项目中使用的文档。

Also look at the url headers for the website in IIS.

另请查看IIS中网站的网址标题。

#6


0  

On some of our servers we have both versions of the .NET framework. In IIS I typically have to set what version the virtual directory should be using. This can cause problems running it on the server.

在我们的一些服务器上,我们有两个版本的.NET框架。在IIS中,我通常必须设置虚拟目录应使用的版本。这可能会导致在服务器上运行它时出现问题。

#7


0  

First make sure you have installed and configured IIS server. To check whether IIS server is installed: Run->inetmgr press enter. To know how to install and configure IIS server check the following Link: http://chalaki.com/install-iis6-windows-xp-professional-sp3-setup-run-csharp-cgi/425/

首先确保已安装并配置IIS服务器。要检查是否安装了IIS服务器:运行 - > inetmgr按enter键。要了解如何安装和配置IIS服务器,请检查以下链接:http://chalaki.com/install-iis6-windows-xp-professional-sp3-setup-run-csharp-cgi/425/

To develop Website using Visual developer with IIS instead of "default ASP.NET Development Server", In the new website window under "Location" click on "Browse" to see the different Server options including IIS Server. User can select the server as IIS server instead of "File System", then the "Location" option will be "HTTP" instead of "File System".

要使用Visual开发人员使用IIS而不是“默认的ASP.NET开发服务器”开发网站,请在“位置”下的新网站窗口中单击“浏览”以查看包括IIS服务器在内的不同服务器选项。用户可以选择服务器作为IIS服务器而不是“文件系统”,然后“位置”选项将是“HTTP”而不是“文件系统”。

In Visual developer 2008 under Properties->Start Option->Server->"Use local IIS server" option is not shown, Even though IIS server was installed and configured successfully. the only options shown are "use default server" and " Use custom server with base URL".

在Visual Developer 2008中的Properties-> Start Option-> Server - >“Use local IIS server”选项未显示,即使IIS服务器已成功安装和配置。显示的唯一选项是“使用默认服务器”和“使用带有基本URL的自定义服务器”。

So in Visual developer 2008 to run on IIS server(If IIS server is installed), Need do the following:

因此在Visual developer 2008中要在IIS服务器上运行(如果安装了IIS服务器),需要执行以下操作:

New Website -> Under Locations Click on "Browse" -> Click on "Local IIS" and then select the "IIS Virtual Directory"(IIS vitual Directory which is directory created by the user while configuring IIS server) -> Open

新网站 - >在地点下单击“浏览” - >单击“本地IIS”,然后选择“IIS虚拟目录”(IIS虚拟目录,这是用户在配置IIS服务器时创建的目录) - >打开

While Running/debugging, the server which you selected while creating the website, the same server will used to open the website, that is while creating the website if you selected "IIS Server" then the website will be opened though IIS server.

在运行/调试时,您在创建网站时选择的服务器,同一服务器将用于打开网站,即在创建网站时,如果您选择“IIS服务器”,则网站将通过IIS服务器打开。

One more thing is, while installing Visual developer 2008 and IIS server, If you installed IIS server after installing Visual studio then you need to do the following before creating new website:

还有一件事是,在安装Visual developer 2008和IIS服务器时,如果在安装Visual Studio之后安装了IIS服务器,那么在创建新网站之前需要执行以下操作:

Run ->cmd press enter (then enter the following Command)-> C:\WINDOWS\Microsoft.NET\Framework\Version# aspnet_regiis -i press Enter then you get message after 3 seconds "ASP.net was installed successfully". (*Version# will be v2.0.50727 in most cases)

运行 - > cmd按回车键(然后输入以下命令) - > C:\ WINDOWS \ Microsoft.NET \ Framework \ Version#aspnet_regiis -i按回车键,然后在3秒后收到消息“ASP.net安装成功”。 (*大多数情况下版本号为v2.0.50727)