积极答复者
host 在IIS里的多端点问题,

问题
-
配置文件如下, <system.serviceModel> <services> <service behaviorConfiguration="CRR.Services.Ecommerce_OrderService_Behavior" name="CRR.Services.Ecommerce_OrderService"> <endpoint address="" binding="basicHttpBinding" name="Ecommerce_OrderServiceEndPoint" bindingNamespace="urn:CompanyName.ProjectName" contract="CRR.Services.IEcommerce_OrderService" /> <endpoint address="abcd" binding="wsHttpBinding" name="Ecommerce_OrderServiceEndPoint" bindingNamespace="urn:CompanyName.ProjectName" contract="CRR.Services.IEcommerce_OrderService" /> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> </service> </services> <behaviors> <serviceBehaviors> <behavior name="CRR.Services.Ecommerce_OrderService_Behavior"> <serviceMetadata httpGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="false" /> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel> 我在客户端通过add service reference 添加下面的URL是可以的 http://localhost/CRR.Host/CustomServices/Ecommerce/Ecommerce_OrderService.svc 但是下面的却不行, http://localhost/CRR.Host/CustomServices/Ecommerce/Ecommerce_OrderService.svc/abcd 报如下的错误: "There was an error downloading 'http://localhost/CRR.Host/CustomServices/Ecommerce/Ecommerce_OrderService.svc/abcd'. The request failed with HTTP status 400: Bad Request. Metadata contains a reference that cannot be resolved: 'http://localhost/CRR.Host/CustomServices/Ecommerce/Ecommerce_OrderService.svc/abcd'. Metadata contains a reference that cannot be resolved: 'http://localhost/CRR.Host/CustomServices/Ecommerce/Ecommerce_OrderService.svc/abcd'. If the service is defined in the current solution, try building the solution and adding the service reference again." 请问如何解决?
答案
-
Hi,If you hosted your WCF Service in IIS,The address of endpoint is determined by the address of its .svc file which can be accessed through IE browser. You can put the address of service in the address bar of IE to check whether it can be accessed successfully. But i found if you change the address of mex to abcd, then you can add service reference using the following URL.
Such as: http://localhost/ServiceModelSamples/service.svc/abcd
Please mark the replies as answers if they help or unmark if not. If you have any feedback about my replies, please contact msdnmg@microsoft.com Microsoft One Code Framework- 已标记为答案 Peter pi - MSFTModerator 2011年7月22日 1:00
全部回复
-
配置文件重新贴一次吧
Frank Xu Lei--谦卑若愚,好学若饥
专注于.NET平台下分布式应用系统开发和企业应用系统集成
Focus on Distributed Applications Development and EAI based on .NET
【老徐的网站】:http://www.frankxulei.com/
-
Hi,If you hosted your WCF Service in IIS,The address of endpoint is determined by the address of its .svc file which can be accessed through IE browser. You can put the address of service in the address bar of IE to check whether it can be accessed successfully. But i found if you change the address of mex to abcd, then you can add service reference using the following URL.
Such as: http://localhost/ServiceModelSamples/service.svc/abcd
Please mark the replies as answers if they help or unmark if not. If you have any feedback about my replies, please contact msdnmg@microsoft.com Microsoft One Code Framework- 已标记为答案 Peter pi - MSFTModerator 2011年7月22日 1:00