Bar*_*xto 10 asp.net-mvc wcf web-services visual-studio-2010
当我更新服务参考时,我最终得到:
无法加载合同"MyService.MainServiceSoap"的端点配置部分,因为找到了该合同的多个端点配置.请按名称指明首选端点配置部分.
我的web.config最终如下:
终点:
<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" />
Run Code Online (Sandbox Code Playgroud)
绑定:
<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>
Run Code Online (Sandbox Code Playgroud)
我手动删除customBinding和Soap12端点,一切正常.但是,如果我再次更新服务(右键单击"更新服务引用"),则会再次添加添加的自定义绑定,从而导致错误并需要手动从配置文件中删除.
有人知道如何解决这个问题吗?我不想/需要自定义soap12绑定.
这是服务配置文件:
<?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, 
Version=6.3.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>
</DbProviderFactories>
</system.data>
</configuration>
Run Code Online (Sandbox Code Playgroud)
.NET 2.0 中的新 ASMX 运行时支持 SOAP 1.2。目前 SOAP 1.1 在业界应用最为广泛。在 .NET Framework 中,同时支持 SOAP 1.1 和 SOAP 1.2。这意味着在 .NET Framework 2.0 中创建的 Web 服务将配置为支持 SOAP 1.1 和 SOAP 1.2 消息。这间接意味着为Web 服务创建的WSDL 将具有两种类型的绑定,即SOAP 1.1 和SOAP 1.2。
这就是生成两个绑定的原因。
<remove name="HttpSoap12"/>
Run Code Online (Sandbox Code Playgroud)
我想这就是您禁用此功能的方式,现在我可以理解为什么您将其视为解决方法。当您将 Web 服务迁移到新框架时,可能有某些原因导致了这种情况,这就是为什么 1.1 上的一些旧 Web 服务可能不会以相同的方式响应。尝试以 2.0 框架为目标,看看会发生什么。
归档时间: |
|
查看次数: |
4620 次 |
最近记录: |