首页 新闻 搜索 专区 学院

WCF 配置多个EndPoint出现错误

0
悬赏园豆:20 [待解决问题]
<?xml version="1.0" encoding="utf-8"?>
<configuration>

  <system.web>
    <compilation debug="true" />
  </system.web>

  <!-- When deploying the service library project, the content of the config file must be added to the host's 
  app.config file. System.Configuration does not support config files for libraries. -->

  <system.serviceModel>
    <services>
<service name="AppWcfServicesLibrary.AnnounceBLLService" behaviorConfiguration="announceBehavior"> <host> <baseAddresses> <add baseAddress="http://192.168.0.128:8732/AnnounceBLLService/" /> </baseAddresses> </host> <endpoint address="AppWcfServicesLibrary/MockCategoryService/" binding="wsHttpBinding" contract="AppWcfServicesLibrary.ICategoryService" bindingConfiguration="wsHttpBindingConfiguration"> </endpoint> <endpoint address="AppWcfServicesLibrary/MockAnnounceService/" binding="wsHttpBinding" contract="AppWcfServicesLibrary.IAnnounceService" bindingConfiguration="wsHttpBindingConfiguration"> </endpoint> <endpoint address="category" binding="mexHttpBinding" contract="IMetadataExchange" /> </service> </services> <bindings> <wsHttpBinding> <binding name="wsHttpBindingConfiguration"> <security mode="None"> </security> </binding> </wsHttpBinding> </bindings> <behaviors> <serviceBehaviors> <behavior name="metadataBehavior"> <serviceMetadata httpGetEnabled="True" httpGetUrl="http://192.168.0.128:8732/northwindservice/metadata"/> <serviceDebug includeExceptionDetailInFaults="False" /> <dataContractSerializer maxItemsInObjectGraph="6553600"/> </behavior> <behavior name="announceBehavior"> <serviceMetadata httpGetEnabled="True" httpGetUrl="http://192.168.0.128:8732/northwindservice/announce"/> <serviceDebug includeExceptionDetailInFaults="False" /> <dataContractSerializer maxItemsInObjectGraph="6553600"/> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel> <connectionStrings> <add name="NorthwindEntities" connectionString="metadata=res://*/Northwind.csdl|res://*/Northwind.ssdl|res://*/Northwind.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=.;initial catalog=Northwind;integrated security=True;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" /> </connectionStrings> </configuration>

 运行的时候出现Cannot obtain Metadata from http://192.168.0.128:8732/AnnounceBLLService/category If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address

的错误,删掉一个endpoint节点就正确,不知道为什么。。。。。

翱翔NET的主页 翱翔NET | 初学一级 | 园豆:35
提问于:2012-06-15 11:14
< >
分享
所有回答(4)
0

你的地址address一样,无法区别吧。

悟行 | 园豆:12427 (专家六级) | 2012-06-15 11:22

是基地址一样呢还是endpoint相对地址一样?endPoint的  两个地址不一样啊address="AppWcfServicesLibrary/MockCategoryService/"

address="AppWcfServicesLibrary/MockAnnounceService/

支持(0) 反对(0) 翱翔NET | 园豆:35 (初学一级) | 2012-06-15 11:29
0

其实异常信息已经说得很明白了,由于两个终结点的address相同,所以当你访问的时候,服务器不知道你访问哪一人终结点,所以说了这句话,which you have access

JustYong | 园豆:7 (初学一级) | 2012-06-15 11:22

分明不一样啊

address="AppWcfServicesLibrary/MockCategoryService/"

address="AppWcfServicesLibrary/MockAnnounceService/

支持(0) 反对(0) 翱翔NET | 园豆:35 (初学一级) | 2012-06-15 11:30
0

两个service endpoint 但是只有一个 metadata publish  <endpoint address="category" binding="mexHttpBinding" contract="IMetadataExchange" />

应该是这里错了吧  再加一个

gunsmoke | 园豆:3592 (老鸟四级) | 2012-07-26 08:09
0

减少一个behavior 试试

chenping2008 | 园豆:9836 (大侠五级) | 2012-09-05 13:10
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册