IIS上发布时<serviceHostingEnvironment multipleSiteBindingsEnabled ="true"/>出错

Sun*_*nny 14 iis wcf

我有一个测试wcf服务与默认方法和Web配置是:

 <system.web>
    <compilation debug="true" targetFramework="4.0"/>
</system.web>
<system.serviceModel>
    <behaviors>
        <serviceBehaviors>
            <behavior>
                <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
                <serviceMetadata httpGetEnabled="true"/>
                <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
                <serviceDebug includeExceptionDetailInFaults="false"/>
            </behavior>
        </serviceBehaviors>
    </behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
</system.serviceModel>
<system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
Run Code Online (Sandbox Code Playgroud)

在本地IIS上,当我发布它时工作正常.但是当我尝试在远程IIS上发布时,我收到此错误:

描述:处理为此请求提供服务所需的配置文件时发生错误.请查看下面的具体错误详细信息并相应地修改配置文件.

分析器错误消息:在应用程序级别之外使用注册为allowDefinition ='MachineToApplication'的部分是错误的.此错误可能是由于未在IIS中将虚拟目录配置为应用程序引起的.

Line 23:       </service>
Line 24:     </services>
**Line 25:        <serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>**
Line 26:  </system.serviceModel>
Line 27:  <system.webServer>
Run Code Online (Sandbox Code Playgroud)

提前致谢.

Sun*_*nny 15

我得到了解决方案:

在IIS中,如果应用程序确实是应用程序,而不是虚拟目录?图标应该看起来像地球,而不是文件夹的图标.如果没有,请将其转换为应用程序,右键单击文件夹select deploy,然后运行Application.Service