更新服务参考坚持加入到SOAP12配置。 [英] Update Service Reference insist on adding Soap12 to Config.

查看:652
本文介绍了更新服务参考坚持加入到SOAP12配置。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我更新服务引用我结束了:

合同MyService.MainServiceSoap端点配置部分无法加载,因为该合同多个端点配置被发现。请说明姓名preferred端点配置部分。

我的web.config结束这样的:

端点:

 <端点地址=HTTP://localhost/main/MainService.asmx
    绑定=basicHttpBinding的bindingConfiguration =MainServiceSoap
    合同=MyService.MainServiceSoapNAME =MainServiceSoap/>
  <端点地址=HTTP://localhost/main/MainService.asmx
    绑定=customBindingbindingConfiguration =MainServiceSoap12
    合同=MyService.MainServiceSoapNAME =MainServiceSoap12/>

绑定:

 <&basicHttpBinding的GT;
    <绑定名称=MainServiceSoapcloseTimeout =00:01:00openTimeout =00:01:00
      receiveTimeout =00:10:00的SendTimeout =00:01:00allowCookies =假
      bypassProxyOnLocal =假hostNameComparisonMode =StrongWildcard
      MAXBUFFERSIZE =655360maxBufferPoolSize =5242880maxReceivedMessageSize =655360
      messageEncoding =TEXTtextEncoding =UTF-8transferMode =缓冲
      useDefaultWebProxy =真正的>
      < readerQuotas MAXDEPTH =32maxStringContentLength =81920maxArrayLength =163840
        maxBytesPerRead =40960maxNameTableCharCount =163840/>
      <安全模式=无>
        <运输clientCredentialType =无proxyCredentialType =无
          境界=/>
        <消息clientCredentialType =用户名algorithmSuite =默认/>
      < /安全>
    < /&结合GT;
  < / basicHttpBinding的>
  < customBinding>
    <绑定名称=MainServiceSoap12>
      < textMessageEncoding maxReadPoolSize =64maxWritePoolSize =16
        messageVersion =SOAP12writeEncoding =UTF-8>
        < readerQuotas MAXDEPTH =32maxStringContentLength =8192maxArrayLength =16384
          maxBytesPerRead =4096maxNameTableCharCount =16384/>
      < / textMessageEncoding>
      < httpTransport manualAddressing =假maxBufferPoolSize =524288
        maxReceivedMessageSize =65536allowCookies =假authenticationScheme =无名氏
        bypassProxyOnLocal =false的DECOM pressionEnabled =真hostNameComparisonMode =StrongWildcard
        keepAliveEnabled =真MAXBUFFERSIZE =65536proxyAuthenticationScheme =无名氏
        境界=transferMode =缓冲unsafeConnectionNtlmAuthentication =假
        useDefaultWebProxy =真/>
    < /&结合GT;
  < / customBinding>

我手动删除customBinding和SOAP12终点,一切工作正常。但是,如果我再次更新服务(右键单击更新服务参考)添加自定义绑定再次增加导致的错误,并需要手动从配置文件中删除。

是否有人知道如何解决这一问题?我不希望/需要自定义SOAP12结合。

这是服务配置文件:

 <?XML版本=1.0&GT?;
<结构>
  <&的System.Web GT;
    <全球化文化=ES-PY的UICulture =ES-PY/>
    <的customErrors模式=关/>
    <&Web服务GT;
&所述;! - 试图添加和/或移除的协议和conformanceWarnings - >
      <&协议GT;
        <添加名称=HTTPGET/>
        <添加名称=HttpPost/>
      < /协议>
&所述;! - - >
      < conformanceWarnings>
        <清除NAME =BasicProfile1_1/>
      < / conformanceWarnings>
    < / WebServices的>
    <编译调试=真targetFramework =4.0/>
  < /system.web>
  < system.serviceModel>
    < standardEndpoints>
      < webHttpEndpoint>
        < standardEndpoint NAME =标准maxReceivedMessageSize =6553600MAXBUFFERSIZE =6553600transferMode =流helpEnabled =真automaticFormatSelectionEnabled =真>
          < readerQuotas maxStringContentLength =65536000maxArrayLength =163840/>
        < / standardEndpoint>
      < / webHttpEndpoint>
    < / standardEndpoints>
    <&行为GT;
      < serviceBehaviors>
        <&行为GT;          <! - 为了避免泄露的元数据信息,下面设置为false的价值和部署之前删除上面的元数据终结点 - >
          &所述;! - &下; serviceMetadata httpGetEnabled =真/&GT - →;
          <! - 要接收故障中的异常细节进行调试,下面设置为true值。设置为false部署之前,以避免泄露异常信息 - >
          < serviceDebug includeExceptionDetailInFaults =真/>        < /行为>
      < / serviceBehaviors>
    < /行为>
<! - 尝试设置multipleSiteBindingEnalbed真假 - >
    < serviceHostingEnvironment multipleSiteBindingsEnabled =真aspNetCompatibilityEnabled =真/>
&所述;! - - >  < /system.serviceModel>
  < system.webServer>
    <模块runAllManagedModulesForAllRequests =真/>
  < /system.webServer>
  <&是connectionStrings GT;
    <清/>
    <添加名称=GamblingEntities的connectionString =...的providerName =System.Data.EntityClient/>
    <添加名称=GamblingSiteEntities的connectionString =...的providerName =System.Data.EntityClient/>
  < /&是connectionStrings GT;
  <&System.Data这GT;
    < D​​bProviderFactories>
      <清/>
      <MySQL的净Framework数据提供程序添加名称=MySQL的数据提供程序不变=MySql.Data.MySqlClient描述= TYPE =MySql.Data.MySqlClient.MySqlClientFactory,MySql.Data,&安培; #xA;版本= 6.3.6.0,文化=中性公钥= c5687fc88969c44d/>
    < / DbProviderFactories>
  < /system.data>
< /结构>


解决方案

在.NET 2.0中新的ASMX运行时支持SOAP 1.2。在这一刻SOAP 1.1,最广泛被用在工业。在.NET Framework都SOAP 1.1和SOAP 1.2的支持。这意味着,在.NET框架2.0创建的Web服务将被配置为支持SOAP 1.1和SOAP 1.2消息。这间接意味着从而为Web服务创建的WSDL将有两种类型的绑定,即,SOAP 1.1和SOAP 1.2

从这里摘自

这是为什么正在生成两个绑定。

 <清除NAME =HttpSoap12/>

我想这我如何禁用这个现在我能理解为什么你认为这是一个解决办法。
一些可能导致此当你移动你的Web服务的新框架,这就是为什么有些对1.1您的旧的Web服务可能不以同样的方式回应。
针对试2.0框架,也许看看会发生什么。

When I update a Service Reference I end up with :

An endpoint configuration section for contract 'MyService.MainServiceSoap' could not be loaded because more than one endpoint configuration for that contract was found. Please indicate the preferred endpoint configuration section by name.

my web.config ends up like this:

endpoints:

  <endpoint address="http://localhost/main/MainService.asmx"
    binding="basicHttpBinding" bindingConfiguration="MainServiceSoap"
    contract="MyService.MainServiceSoap" name="MainServiceSoap" />
  <endpoint address="http://localhost/main/MainService.asmx"
    binding="customBinding" bindingConfiguration="MainServiceSoap12"
    contract="MyService.MainServiceSoap" name="MainServiceSoap12" />

bindings:

  <basicHttpBinding>
    <binding name="MainServiceSoap" closeTimeout="00:01:00" openTimeout="00:01:00"
      receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
      bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
      maxBufferSize="655360" maxBufferPoolSize="5242880" maxReceivedMessageSize="655360"
      messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
      useDefaultWebProxy="true">
      <readerQuotas maxDepth="32" maxStringContentLength="81920" maxArrayLength="163840"
        maxBytesPerRead="40960" maxNameTableCharCount="163840" />
      <security mode="None">
        <transport clientCredentialType="None" proxyCredentialType="None"
          realm="" />
        <message clientCredentialType="UserName" algorithmSuite="Default" />
      </security>
    </binding>
  </basicHttpBinding>
  <customBinding>
    <binding name="MainServiceSoap12">
      <textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16"
        messageVersion="Soap12" writeEncoding="utf-8">
        <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
          maxBytesPerRead="4096" maxNameTableCharCount="16384" />
      </textMessageEncoding>
      <httpTransport manualAddressing="false" maxBufferPoolSize="524288"
        maxReceivedMessageSize="65536" allowCookies="false" authenticationScheme="Anonymous"
        bypassProxyOnLocal="false" decompressionEnabled="true" hostNameComparisonMode="StrongWildcard"
        keepAliveEnabled="true" maxBufferSize="65536" proxyAuthenticationScheme="Anonymous"
        realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false"
        useDefaultWebProxy="true" />
    </binding>
  </customBinding>

I manually delete customBinding and Soap12 endpoint and everything works fine. But if I update the service again (right click Update Service Reference) the added custom binding is added again causing error and the need to manually remove from config file.

Does someone knows how to fix this ? I don't want/need a custom soap12 binding.

This is the service config file:

<?xml version="1.0"?>
<configuration>
  <system.web>
    <globalization culture="es-PY" uiCulture="es-PY"/>
    <customErrors mode="Off"/>
    <webServices>
<!-- Tried adding and/or removing protocols and conformanceWarnings -->
      <protocols>
        <add name="HttpGet"/>
        <add name="HttpPost"/>
      </protocols>
<!-- -->
      <conformanceWarnings>
        <remove name="BasicProfile1_1"/>
      </conformanceWarnings>
    </webServices>
    <compilation debug="true" targetFramework="4.0"/>
  </system.web>
  <system.serviceModel>
    <standardEndpoints>
      <webHttpEndpoint>
        <standardEndpoint name="standard" maxReceivedMessageSize="6553600" maxBufferSize="6553600" transferMode="Streamed" helpEnabled="true" automaticFormatSelectionEnabled="true">
          <readerQuotas maxStringContentLength="65536000" maxArrayLength="163840" />
        </standardEndpoint>
      </webHttpEndpoint>
    </standardEndpoints>
    <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="true"/>

        </behavior>
      </serviceBehaviors>
    </behaviors>
<!-- Tried setting multipleSiteBindingEnalbed true and false -->
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true"/>
<!--  -->

  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>
  <connectionStrings>
    <clear/>
    <add name="GamblingEntities" connectionString="..." providerName="System.Data.EntityClient" />
    <add name="GamblingSiteEntities" connectionString="..." providerName="System.Data.EntityClient" />
  </connectionStrings>
  <system.data>
    <DbProviderFactories>
      <clear/>
      <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, &#xA;Version=6.3.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>
    </DbProviderFactories>
  </system.data>
</configuration>

解决方案

The new ASMX runtime in .NET 2.0 supports SOAP 1.2. At this moment SOAP 1.1 is most widely being used in the industry. In the .NET Framework both SOAP 1.1 and SOAP 1.2 are supported. This means that the Web Services created in .NET Framework 2.0 will be configured to support both SOAP 1.1 and SOAP 1.2 messages. This indirectly means that the WSDLs thus created for the Web Service will have two types of bindings, i.e., SOAP 1.1 and SOAP 1.2.

Taken from here

This is why two bindings are being generated.

<remove name="HttpSoap12"/>

I guess this i how you disable this now i can understand why you see this as a workaround. Something may have caused this when you moved your web service to the new framework and this is why some of your older web services on 1.1 possibly don't respond in the same way. Try targeting 2.0 framework maybe to see what happens.

这篇关于更新服务参考坚持加入到SOAP12配置。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆