WCF服务混合构建错误

时间:2017-09-05 00:09:11

标签: c# wcf

我正在开发WCF服务,当我调试应用程序时它运行正常,但是,当我尝试创建发布版本时,我收到此消息:

  

混合模式程序集是针对版本' v2.0.50727'运行时的运行时,如果没有其他配置信息,则无法在4.0运行时加载。

在互联网和StackOverflow搜索,我发现Web.Config中的这段代码可以解决问题:

<startup useLegacyV2RuntimeActivationPolicy="true">
   <supportedRuntime version="v2.0.50727"/>
</startup>

还试过这个:

<startup useLegacyV2RuntimeActivationPolicy="true">
   <supportedRuntime version="v4.0"/>
</startup>

来源的例子:

What 'additional configuration' is necessary to reference a .NET 2.0 mixed mode assembly in a .NET 4.0 project?

Mixed mode assembly in .NET 4

但我仍然收到错误消息。你有什么建议吗?

我的网络配置:

<?xml version="1.0"?>
<configuration>
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v2.0.50727"/>
  </startup>
  <configSections>
    <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
      <section name="SITEC.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
    </sectionGroup>
  </configSections>
  <appSettings>
    <add key="HSM_Ip" value="3001@192.168.0.6"/>
    <add key="HSM_User" value="Cryxo"/>
    <add key="HSM_Pass" value="123456"/>
    <add key="HSM_LlaveID_Data" value="CryxoKey"/>
    <add key="HSM_LlaveID_Firma" value="CryxoKey"/>
    <add key="HSM_Grupo" value="CRYXO"/>
    <add key="HSM_TimeOut" value="6000"/>
    <add key="URL_Servicio" value="http://www.gmail.com"/>
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.5"/>
    <httpRuntime/>
    <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
  </system.web>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <protocolMapping>
      <add binding="basicHttpsBinding" scheme="https"/>
    </protocolMapping>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
     <directoryBrowse enabled="true"/>
  </system.webServer>
  <applicationSettings>
    <SITEC.Properties.Settings>
      <setting name="SITEC_AWWW_Awww" serializeAs="String">
        <value>http://192.168.10.120:8081/Afwww</value>
      </setting>
      <setting name="SITEC_AIMGProc" serializeAs="String">
    <value>http://localhost:8080/services/ImagesProcessorWS</value>
  </setting>
    </SITEC.Properties.Settings>
  </applicationSettings>
</configuration>

0 个答案:

没有答案