2012-03-30 67 views
1

也許你可以幫我設置我的WCF服務。有沒有渠道積極傾聽

首先,這裏是我的配置文件:

<system.serviceModel> 
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> 

    <bindings /> 
<services> 
    <service name="AuthenticatorService.Authenticator"> 
    <endpoint address="auth" binding="basicHttpBinding" bindingConfiguration="" 
     name="AuthEndpoint" contract="AuthInterface.IAuthenticator" /> 
    <endpoint address="mex" binding="mexHttpBinding" name="MetadataEndpoint" 
     contract="IMetadataExchange" /> 
    </service> 
</services> 
<behaviors> 
    <serviceBehaviors> 
    <behavior> 
     <serviceMetadata httpGetEnabled="True" /> 
     <serviceDebug includeExceptionDetailInFaults="True" /> 
    </behavior> 
    </serviceBehaviors> 
</behaviors> 

這是我打電話給我的服務從C#:

 //This creates a link to the WCF service using basicHttpBingind 
     httpFactory = new ChannelFactory<IAuthenticator>(new BasicHttpBinding(), new EndpointAddress("http://myUrl/auth.svc")); 

     httpProxy = httpFactory.CreateChannel(); 

它工作得很好,我就這樣做時,本地主機,但現在它一直告訴我沒有找到終端。

另外,服務器生成以下錯誤:

System.ServiceModel.EndpointNotFoundException:沒有通道主動偵聽在的 'http://myURL/auth.svc/$metadata'。這通常是由不正確的地址URI造成的。確保消息發送到的地址與服務正在偵聽的地址匹配。

我真的很困惑,我不知道爲什麼會發生這種情況。我是否需要爲元數據交換創建另一個服務文件?

我是否需要設置baseAddress?

感謝

回答

0

你是如何部署的服務?我假設你的服務在IIS中運行 - 你是否嘗試在瀏覽器中打開服務URL(http://myUrl/auth.svc)以查看它是否確實存在?