开发者

Expose WSDL on Remote Server

Is there a clever way to expose WSDL from a WCF servic开发者_开发技巧e hosted on one IIS server automatically on another server?

Thanks


The WSDL is automatically generated from the WCF infrastructure. So if you don't deploy the web service on this server you cannot expose the WSDL. You could of course manually copy the generated XML files but if the original web service changes you will need to update them on other server.


Well if you want to make the WSDL from another server accurate for yours and you're just passing on all requests you'll probably only have to update the wsdl:service element of the WSDL with the new correct end-points (Likely by replacing the internal domain with the external one).

You can either do this by hand and just update the public-facing WSDL whenever you change the back-end code or do it on-the-fly by parsing it with an XmlDocument and updating the relevant nodes before rendering the output. I don't believe anything will automate this for you.


I have no idea if you found that answer yet, but

a WCF Service has endpoints, defined by in its web.config. one of those is called

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

and is defined for a IMetadataExchange contract. Now this guy has to have a behavior defined in the same file

<behavior name="OverlayService.Service1Behavior">
   <serviceMetadata httpGetEnabled="true"/>
   <serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>

Service1Behavior is the behavior of the whole WCF Service, and it enables httpGet operation on ServiceMetadata.

mex is default name for the Metadata service address.

Put any port you want here, but one advise, go 8000-9000 and beyond.

<Host>
<add baseAddress="http://localhost:8080" /> 
</Host>

is in the web.config , it is direct child of the tag you are defining, (its between and , unested further)

WCF service better be in virtual IIS path : http://localhost/servicename.svc and by the way there will not be a "mex" folder in IIS, its in the assembly and the IMetadata needs no system definition, it is part of the .net definition, no need to have a file for it it a well-know name.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜