0

私は Web サービスを稼働させており、ブラウザーを介してそれにアクセスし、稼働していることを確認できます。また、https がなくても、Web サービスを呼び出すことができます。

現時点で電話をかけるために、小さなコンソール アプリケーションを使用してテストし、結果を確認しています。

サーバー側の私の web.config は次のとおりです。

サービス部門

<services>
    <service name="Website.mynamespace.Service1">
        <endpoint address="/service.svc" behaviorConfiguration=""  binding="wsHttpBinding" contract="SomeDLLFile.Anothernamespace.Services.Proxy.Interface1" ></endpoint>
        <endpoint address="/service.svc" behaviorConfiguration="" binding="wsHttpBinding" contract="SomeDLLFile.Anothernamespace.Services.Proxy.Interface1" bindingConfiguration="myBinding" />
        <endpoint address="mex" binding="wsHttpBinding" contract="IMetadataExchange"/>
      </service>
      <service name="Website.mynamespace.Service2">
        <endpoint address="/service.svc" behaviorConfiguration=""  binding="wsHttpBinding" contract="SomeDLLFile.Anothernamespace.Services.Proxy.Interface2" ></endpoint>
        <endpoint address="/service.svc" behaviorConfiguration="" binding="wsHttpBinding" contract="SomeDLLFile.Anothernamespace.Services.Proxy.Interface2" bindingConfiguration="myBinding" />
        <endpoint address="mex" binding="wsHttpBinding" contract="IMetadataExchange"/>
      </service>
</services>

使用したバインディング

  <wsHttpBinding>
    <binding name="myBinding">
      <security mode="Transport">
        <transport clientCredentialType="None"/>
        </security>
    </binding>
  </wsHttpBinding>

クライアント側 (コンソール アプリケーション) で、Web サービスへのサービス参照を追加しました。このようにして、HTTP 経由で呼び出しを行うことができます。ただし、HTTPS を使用すると、次のようなエラーが表示されます

"There was no endpoint listening at https://test.mywebsite.nl/service.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details."

コンソール アプリケーションの app.config は次のようになります。

<client>
      <endpoint address="https://test.mywebsite.nl/service.svc" 
                binding="basicHttpBinding"
                bindingConfiguration="BasicHttpBinding_IProxyInterface1"
                contract="Service.IProxyInterface1" 
                name="BasicHttpBinding_IProxyClientInterface" />
      <endpoint address="https://test.mywebsite.nl/service.svc" 
                binding="basicHttpBinding"
                bindingConfiguration="BasicHttpBinding_IProxyInterface2"
                contract="Service.IProxyInterface2" 
                name="BasicHttpBinding_IProxyInterface2" />
</client>

<behaviors>
  <serviceBehaviors>
    <!-- 
      Step 2. Inside a <serviceBehaviors> section, add 
      a name attribute in the <behaviors> element that 
      matches the behaviorConfiguration attribute in the
      <service> element above.
    -->
    <behavior name="">
      <serviceMetadata httpGetEnabled="true" httpGetUrl=""/>
      <serviceDebug httpHelpPageEnabled="true" includeExceptionDetailInFaults="true" />
    </behavior>
  </serviceBehaviors>
</behaviors>

内部例外を見ていると、404 エラーが表示されます。SOに関する他のトピックやMSの記事からさまざまな提案を試みましたが、まだ同じエラーが表示されているため、何かが欠けているに違いありません。ここで私が間違っていることを誰か知っていますか?

4

2 に答える 2

1

SO のこのトピックのおかげで、問題は解決しました。

問題はサービス名にあったため、1 つのサービス定義で両方のコントラクトにエンドポイントを結合しました。また、wsHttpBinding を basicHttpBinding に変更しました。

于 2013-01-25T11:33:36.793 に答える
0

私は似たようなものを持っていて、IIS に自己認証 SSL 証明書をインストールしました。試す:

http://weblogs.asp.net/scottgu/archive/2007/04/06/tip-trick-enabling-ssl-on-iis7-using-self-signed-certificates.aspx

明らかに、実稼働環境にデプロイするときに適切な証明書を購入する必要があります。

于 2013-01-23T22:42:47.860 に答える