wcf 终结点的address问题

富坚老贼你更啊 2018-11-23 11:39:01
这个问题痛苦好几天了
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
</startup>
<system.serviceModel>
<services>
<service name="WcfServiceLibrary6.Service1">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8001/"/>
</baseAddresses>
</host>
<endpoint address="abc" binding="basicHttpBinding" contract="WcfServiceLibrary6.IService1" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>


用控制台做宿主配置了这么一段xml。查了很多帖子和翻看了手头的wcf服务编程这本书的第一章。大概意思是,
如果endpoint下的address里填写了相对地址,那么就可以用 http://localhost:8001/abc的方式访问到该地址。
但是反复用了多种方式都是只能用基地址 http://localhost:8001 访问到。后面的abc根本没有起到任何作用。一旦用这种方式访问就会报错



为什么带上相对地址反而访问不到了

...全文
38 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

12,162

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 Web Services
社区管理员
  • Web Services社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧