Multiple endpoints under IIS

柔情痞子 提交于 2019-11-29 11:18:40

It would actually be:

http://localhost/wcfcert/service1.svc/test

If you want the URL to be 'http://localhost/wcfcert/test/service1.svc', then you will need to specify the full URL in the address attribute.

I ran into a similar problem recently, and I believe the reason is because the WcfTestClient requires the mex endpoint to query the metadata for the service it is testing.

When you add the service address "http://localhost:1523/Service1.svc" to the WcfTestClient, it actually queries the endpoint "http://localhost:1523/Service1.svc/mex" to get the service description.

The error "Cannot obtain Metadata from "http://localhost:1523/Service1.svc/test" is displayed because the WcfTestClient is looking for the "/test/mex" endpoint to get the metadata for the service at "/test".

To fix this, you need to add another endpoint to provide metadata about the service hosted at address "/test":

<endpoint address="/test/mex" binding="mexHttpBinding" contract="IMetadataExchange"/>

This is the solution that worked for me.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!