IIS6中给Framework2,。0站点的虚拟目录(2.0版本)下发布Web API项目(4.0版本)问题处理

2023-06-12,,

Web-API项目以虚拟目录形式部署到IIS6/IIS7

若原有站点为Framework2.0版本,在此站点(或虚拟目录站点)下,新增API虚拟目录,然后选择Framework4.0版本,IIS6和IIS7配置有所不同。

IIS6配置:

1)        在主站A中的web.config中,添加<location>节点,要包住<system.web>

和<system.codedom>,节点内容如下:

<location path="." allowOverride="true" inheritInChildApplications="false">

2)         在主站A中的web.config中,删除sectionGroup的“system.web.extensions”、“scriptResourceHandler”、“jsonSerialization”、“profileService”、“authenticationService”、“roleService”的节点;(因为子站中的引用配置与主站重复了。)

3)         虚拟目录转成应用程序:

4)         在IIS中,添加MVC的解析:

5)         以上便完成配置;

IIS7配置:

1)         按照IIS6上面的配置进行,省略第4步骤。

2)         api站点选择“集成模式”

遇到的问题解决方法:

1.

解决方式:webconfig配置文件中的<configuration>节点内增加如下配置文件

<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider,System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
<providerOption name="CompilerVersion" value="v4.0"/>
<providerOption name="WarnAsError" value="false"/>
</compiler>
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
<providerOption name="CompilerVersion" value="v4.0"/>
<providerOption name="OptionInfer" value="true"/>
<providerOption name="WarnAsError" value="false"/>
</compiler>
</compilers>
</system.codedom>

IIS6中给Framework2,。0站点的虚拟目录(2.0版本)下发布Web API项目(4.0版本)问题处理的相关教程结束。

《IIS6中给Framework2,。0站点的虚拟目录(2.0版本)下发布Web API项目(4.0版本)问题处理.doc》

下载本文的Word格式文档,以方便收藏与打印。