2011-12-30 4 views
10

サービスリファレンスを更新すると、次のようになります。アップデートサービスリファレンスは、ConfigにSoap12を追加することを主張しています。

契約の「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" /> 

バインディング:

<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> 

私は手動でcustomBindingとSOAP12エンドポイントを削除し、すべてが正常に動作します。しかし、サービスをもう一度更新すると(Service Referenceの右クリック)、追加されたカスタムバインディングが再度追加され、エラーが発生し、設定ファイルから手動で削除する必要があります。

誰かがこれを修正する方法を知っていますか?私はカスタムのsoap12バインディングが欲しくない/必要がありません。私はちょうど私のプロキシクラスを再構築するsvcutil.exe手動で呼び出す

<?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> 
+0

サービス参照として追加されているアクセスサービスはありますか? –

+0

はい、私は両方の点の開発者を持っています。 –

+0

IISでホストしていますか?その場合は、サイトバインディングとアプリケーションで許可されているプロトコルで何が設定されていますか? –

答えて

2

.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の2種類のバインディングがあることを意味します。

Taken from here

2つのバインディングが生成されている理由です。

<remove name="HttpSoap12"/> 

私はこれをどのように無効にするかと思いますが、私はこれを回避策と見なす理由を理解することができます。 Webサービスを新しいフレームワークに移動したときに何かが発生した可能性があります。そのため、1.1の古いWebサービスの一部が同じように応答しない可能性があります。 2.0のフレームワークをターゲットにして、どうなるか見てみてください。

+0

私はサービスの作成者です! –

+0

はい、私はそれを削除して問題を解決することが分かっていますが、サービスを更新すると、これが再び追加され、web.configに追加されないようにする方法が元の質問です。 –

+0

クライアントではなく元のサービスから削除します。クライアントに参照を追加すると、その参照はもう存在しなくなります。 –

-3

これは、サービス設定ファイルです。ずっと簡単です。

3

堅牢な回避策はありません。私はあなたの質問に投票しました。 I update-or-configure-an-existing-service-reference-in-sl-application-you-get-duplicate-binding-and-endpoint-information

を今私はsvcutilを使用してDLLを生成するに切り替えたが、この問題はここにマイクロソフトに報告されているが、彼らは言った、同じ問題の被害者だ、それがVS2010で固定していますが、私はそれがありません確認し、私はVS2010のSP1あまりにもインストールされていますこれはSP1でも修正されていません。そこで、これは修正されておらず、バグは「外部」として閉じられています。奇妙な。

バグレポートページでも回避策を見つけることができますが、わかりにくいです。

別の回避策は、ダブルエンドポイント

MyService.MainServiceSoap mainServiceSoap =新しいMyServiceでを避けるために、ハードコーディングされたバインディング名を持つサービス・クライアント・オブジェクトを作成しています。MainServiceSoap( "MainServiceSoap");

または最後に、Microsoftで別のバグレポートを開き、修正して修正することができます。

+0

実際にそうであるようです。私もVS2010SP1であなたの発見をチェックしました – Plippie

+0

まだVisual Studio 2012で同じ –

関連する問題