How to host an ASP.NET Web Applications site on II

2019-07-21 13:59发布

问题:

I'm locally working on an ASP.NET Web Applications site. It's almost finished so i wanted to try and put it in an IIS server.

The IIS server is running on a different server. What do i need to do to run my ASP.NET web site in that remote IIS server?

I tried to following:

I copied my entire project directory (so including the .csproj file, the bin folder etc.) to the following location on the remote server, where IIS is running C:\MyProject.

In IIS manager i added a Virtual Directory under Default Web Site. Located my Web Site files in C:\MyProject and added that folder. Then in IIS manager i converted that Virtual Directory to an Application.

But when i browse to my Web Site i get an error:

HTTP Error 500.23 - Internal Server Error

An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode.

So this is probably not the way to do it. I don't think i can just do a Deploy, because i never set up any .axd(?) or anything.

So my question is, what do i have to do in order to run my Web Site on IIS..?

回答1:

The error will be probably because of, you developed the site in .net version 2.0 and try to run under the Integrated pipeline apppool that runs under .net framework 4.0.

SoL:

  1. Create a new apppool with classic mode and .net framework equals to your application developed framework.

  2. attach the newly created apppool to your virtual directory.

Note: For deployment, you don need to copy .csproj or unwanted solution files to destination location.

If it is otherway around, (i.e,) application is .net 4.0 and apppool is 2.0 please follow the below steps.

  1. Update .net framework in the server to 4.0 if you have only 2.0.
  2. Then register .net 4.0 version in IIS by running the following command in command prompt.

C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis -i



回答2:

Try changing Application pool to Classic. To do that open Advanced settings of your application in IIS manager and change Application Pool. There should be "ASP.NET v4.0 Classic" or something similar according to your framework version.

http://technet.microsoft.com/en-us/library/cc731755(v=ws.10).aspx