Windows7下启用IIS7配置ASP运行环境的详细方法及常见调试问题

一、安装IIS7

开始-控制面板-默认程序-程序和功能-打开或关闭windows功能。

注意:设置ASP的时候,Application Development Features下的ASP,ASP.NET一定要勾选好

Windows7下启用IIS7配置ASP运行环境的详细方法及常见调试问题

二、配置IIS

1. IIS Manager可以在管理工具中找到。点击站点,在web home页面中可以看到ASP的图标。

注意:如果没有ASP的图标,可能是在安装IIS的过程中没有勾选ASP选项

Windows7下启用IIS7配置ASP运行环境的详细方法及常见调试问题

2、启用Parent Paths: 选择站点,双击ASP图标,将“Enable Parent Paths” 设置为“True”,右边栏点击“Apply”。

Windows7下启用IIS7配置ASP运行环境的详细方法及常见调试问题

 3. If IIS installed after .Net framework v4.0, the framework need to be reinstalled:

Resolve: "CMD"-> Run as administrator -> %windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i

 4. Modify file Web.config:

<configuration>
  <connectionStrings>
    <add name="ClientConnectionString" connectionString="Data Source=localhost;Initial Catalog=Client;User ID=aaaa;Password=aaaaa" providerName="System.Data.SqlClient"/>
  </connectionStrings>
  <system.web>
    <compilation debug="true" targetFramework="4.0"/>
    <httpRuntime/>
  </system.web>
  <system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701"/>
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+"/>
    </compilers>
  </system.codedom>
</configuration>

a. Framework between IIS Server and the project build framework: targetFramework record the setting Framework in Properties. If .Net 4.0 was set in IIS, the target Framework should be set on 4.0. If they were not match, there will be a "Sever Error" error.

  <system.web>
    <compilation debug="true" targetFramework="4.0"/>
    <httpRuntime/>
  </system.web>

      Resolve1:  Change project framework to the IIS server version, rebuild the project.(non-large project)

      Resolve2:  Configrate Application Pools in IIS, select and click one item and select the right Framework.

stackoverflow: When .NET 4.5 is installed it effectively replaces .NET 4.0 on the machine. .NET 4.0 gets overwritten by a new version of .NET 4.5 which - according to Microsoft - is supposed to be 100% backwards compatible.

Notice: Project framework use .Net 4.5 and .Net 4.5 could not display in IIS server(It always display .Net 4.0), so please make sure your server install .Net 4.5.

Windows7下启用IIS7配置ASP运行环境的详细方法及常见调试问题

 b. delete one compiler.

Windows7下启用IIS7配置ASP运行环境的详细方法及常见调试问题

Resolve:  Delete the Line.

三、配置IIS7的默认网站

 1. Click the "ASP" icon ->"Advanced Setting" -> select the Physical Path

Windows7下启用IIS7配置ASP运行环境的详细方法及常见调试问题

  2. Add the Default Document

Windows7下启用IIS7配置ASP运行环境的详细方法及常见调试问题