我有basicHttpBindings的简单wcf服务,并希望在IIS上托管它.
但是当我指定
<endpoint address="/myAddress" binding="basicHttpBinding" contract="Wcf.Contracts.IPublicService"/>
myAddress时会被忽略.换句话说,我希望它创建我的服务端点,就像这个localhost:1111/myaddress/PublicService.svc,但它只是通过组合localhost和PublicService.svc - localhost:1111/publicservice.svc创建端点.
为什么我需要?我在项目中托管了一些其他服务,并希望在localhost之后使用不同的url创建每个服务.(我不想将它们移动到不同的文件夹).
我已经google了,发现在IIS上托管时忽略了主机基地址,这对于端点地址也是如此吗?
提前致谢
<service name="Wcf.Services.AdminService">
<endpoint address="/address" binding ="basicHttpBinding" contract="Wcf.Contracts.IAdminService"/>
<endpoint address="mex" binding ="mexHttpBinding" contract="IMetadataExchange"/>
</service>
<service name="Wcf.Services.PublicService">
<endpoint address="/address1" binding="basicHttpBinding" contract="Wcf.Contracts.IPublicService"/>
<endpoint address="mex" binding="basicHttpBinding" contract="IMetadataExchange"/>
</service>
Run Code Online (Sandbox Code Playgroud)
Dou*_*las 13
假设您的服务的基地址是http://localhost:1111/PublicService.svc,指定该address="/myAddress"属性将导致该端点的地址变为http://localhost:1111/PublicService.svc/myAddress.端点的相对路径来后服务地址.