2012-03-30 66 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)以查看它是否确实存在?