0

非常に単純な WCF サービスを作成しましたが、何らかの理由でsvcutil. 次のコマンドを使用しています。

svcutil http://localhost:8098/IceVSServer/service?wsdl

次の出力が得られます。

Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 4.0.30319.1]
Copyright (c) Microsoft Corporation.  All rights reserved.

Attempting to download metadata from 'http://localhost:8098/IceVsServer/service?wsdl' using WS-Metadata Exchange or DISCO.
Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 4.0.30319.1]
Copyright (c) Microsoft Corporation.  All rights reserved.

Error: Cannot obtain Metadata from http://localhost:8098/IceVsServer/service?wsdl

If this is a Windows (R) Communication Foundation service to which you have acce
ss, please check that you have enabled metadata publishing at the specified addr
ess.  For help enabling metadata publishing, please refer to the MSDN documentat
ion at http://go.microsoft.com/fwlink/?LinkId=65455.


WS-Metadata Exchange Error
    URI: http://localhost:8098/IceVsServer/service?wsdl

    Metadata contains a reference that cannot be resolved: 'http://localhost:8098/IceVsServer/service?wsdl'.

There was no endpoint listening at http://localhost:8098/IceVsServer/service
?wsdl that could accept the message. This is often caused by an incorrect addres
s or SOAP action. See InnerException, if present, for more details.

The remote server returned an error: (404) Not Found.


HTTP GET Error
    URI: http://localhost:8098/IceVsServer/service?wsdl

There was an error downloading 'http://localhost:8098/IceVsServer/service?wsdl'.

The request failed with HTTP status 404: Not Found.

If you would like more help, type "svcutil /?"

このエラーは、MEX エンドポイントがないことを示しているようです。実際、URL をブラウザに入力すると、XML がすぐに表示されます。

ここに私のapp.configがあります:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.serviceModel>
    <services>
      <service name="IceVSService.IceVsService" behaviorConfiguration="IceVsServiceBehavior">
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8098/IceVsService/service"/>
          </baseAddresses>
        </host>
        <!-- this endpoint is exposed at the base address provided by host: http://localhost:8098/IceVsService/service  -->
        <endpoint address=""
                  binding="wsHttpBinding"
                  contract="IceVSService.IIceVersioningSystem" />
        <!-- the mex endpoint is explosed at http://localhost:8098/IceVsService/service/mex -->
        <endpoint address="mex"
                  binding="mexHttpBinding"
                  contract="IMetadataExchange" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="IceVsServiceBehavior">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="False"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
</configuration>
4

1 に答える 1

1

と混同HttpGetしていMexます。metadata exchange format" " (MEX) または " web service description language" (WSDL)で、サービスの詳細を公開する 2 つの異なる方法があります。

あなたの設定では、両方を定義しました。ただし、属性を定義httpgeturlしていないため、空の文字列のように扱われます。したがって、wsdl アドレスは次のようになります: http://localhost:8098/IceVsService/service?wsdl and not http://localhost:8098/IceVsServer/service(IceVsServer はどこにも定義されていません)。

mex アドレスは svcutil でも機能します。http://localhost:8098/IceVsService/service/mex

于 2012-08-11T05:38:09.187 に答える