我无法弄清楚在我实施" v2"之后出现的WCF服务问题?与它签订合同以扩展功能。一切都很好,但当我尝试在浏览器中访问该服务时,我只是被告知它无法连接。当我尝试将其添加为服务引用时,我会收到有关连接问题的类似消息。但是,当我从配置文件中删除扩展合同的端点时,保留前一个" v1"版本完好无损,工作正常。
这是" v1"合同:
namespace Company.Services.Ticketing.Retail.Contracts
{
[ServiceContract(Name = "OutletReportingContract_v1", Namespace = "https://enterprise.company.ie/Services/Retail")]
public interface IOutletReportingContract_v1
{
/* methods */
}
}
这是" v2"合同:
namespace Company.Services.Ticketing.Retail.Contracts
{
[ServiceContract(Name = "OutletReportingContract_v2", Namespace = "https://enterprise.company.ie/Services/Retail")]
public interface IOutletReportingContract_v2 : IOutletReportingContract_v1
{
/* methods */
}
}
以下是Web.config中的端点:
<service name="Company.Services.Ticketing.Retail.OutletService" behaviorConfiguration="Public">
<endpoint address="1" binding="wsHttpBinding" bindingConfiguration="Standard" name="OutletReportingContract_v1"
contract="Company.Services.Ticketing.Retail.Contracts.IOutletReportingContract_v1" />
<endpoint address="2" binding="wsHttpBinding" bindingConfiguration="Standard" name="OutletReportingContract_v2"
contract="Company.Services.Ticketing.Retail.Contracts.IOutletReportingContract_v2" />
<endpoint address="mex" binding="mexHttpsBinding" name="IMetadataExchange" contract="IMetadataExchange" />
</service>
以下是事件查看器中显示的错误消息:
WebHost无法处理请求。 发件人信息:System.ServiceModel.Activation.HostedHttpRequestAsyncResult / 28075619 例外:System.Web.HttpException(0x80004005):没有频道主动收听&#39; https://phil-pc.company.local/Services/Retail/OutletService.svc/_vti_bin/ListData.svc/ $元数据&#39;。这通常是由错误的地址URI引起的。确保将消息发送到的地址与服务正在侦听的地址匹配。 ---&GT; System.ServiceModel.EndpointNotFoundException:没有频道主动收听&#39; https://phil-pc.company.local/Services/Retail/OutletService.svc/_vti_bin/ListData.svc/ $元数据&#39;。这通常是由错误的地址URI引起的。确保将消息发送到的地址与服务正在侦听的地址匹配。 在System.ServiceModel.Activation.HostedHttpTransportManager.HttpContextReceived(HostedHttpRequestAsyncResult结果) 在System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest() 在System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest() 在System.Runtime.AsyncResult.End [TAsyncResult](IAsyncResult结果) 在System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult结果) 进程名称:w3wp 进程ID:8148
现在有点难过,并希望得到任何帮助:)
答案 0 :(得分:0)
您需要在web.config中分隔您的服务声明。
假设您的实现类名为OutletService_v1&amp; OutletService_v2你应该得到类似的东西:
<services>
<service name="Company.Services.Ticketing.Retail.OutletService_v1" behaviorConfiguration="Public">
<endpoint binding="wsHttpBinding" bindingConfiguration="Standard" contract="Company.Services.Ticketing.Retail.Contracts.IOutletReportingContract_v1" />
<endpoint address="mex" binding="mexHttpsBinding" name="IMetadataExchange" contract="IMetadataExchange" />
</service>
<service name="Company.Services.Ticketing.Retail.OutletService_v2" behaviorConfiguration="Public">
<endpoint binding="wsHttpBinding" bindingConfiguration="Standard" contract="Company.Services.Ticketing.Retail.Contracts.IOutletReportingContract_v2" />
<endpoint address="mex" binding="mexHttpsBinding" name="IMetadataExchange" contract="IMetadataExchange" />
</service>
</services>
&#13;