gpt4 book ai didi

WCF 服务端点与主机基地址

转载 作者:行者123 更新时间:2023-12-03 10:09:12 24 4
gpt4 key购买 nike

所以我对服务端点和主机基地址的用途有点困惑。到目前为止,在我所经历的所有示例中,他们都在讨论使用所需绑定(bind)设置端点,您通常可以导航到这些端点

但是,当我使用以下配置来设置和托管我的服务时,它似乎只公开了主机基地址。

    <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="HostService.EvalService">
<endpoint address="http://localhost:8080/basic"
binding="basicHttpBinding" contract="HostService.IEvalService" />
<endpoint address="http://localhost:8080/ws"
binding="wsHttpBinding" contract="HostService.IEvalService" />
<endpoint address="mex" binding="mexHttpBinding"
name="mex" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8080/EvalsService" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>

谁可以给我解释一下这个?

最佳答案

在 IIS 上托管 WCF 服务时,基地址只能是 .svc 文件的 URL。如果您指定任何其他基地址,它将被忽略。您仍然可以为端点指定相对 URI,例如 address="basic"address = "ws" .那么端点上的地址就变成了<URL to the .svc file>/basic<URL to the .svc file>/ws在这种情况下。

关于WCF 服务端点与主机基地址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6937853/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com