Monday, June 9, 2008

WSDL For WCF ASP.Net service uses local machine name

I've finally found myself with an opportunity to develop and deploy my first WCF service. I know I am several years behind the game but that's what happens when you work for a company which becomes stagnant in their adoption of technology (It is so nice to once again be back with a small and nimble startup).

There are some good articles on deploying a WCF service to IIS on MSDN. Which I recommend reading. I ran into an issue in the the wsdl for my service was using the localmachine name for all the bindings. The autogenerated page you get when you navigate to the .svc page said use: svcutil.exe http://[machinename]/MyService.svc to generate a proxy.

I discovered that in order to get the real URL in here (And within the WSDL for the imports), I needed to set a host header with my domain name. See KB 324287 for more information on how to do this. Once I had configured the host header I was all set.

If you need to do this for a service which is hosted on SSL, you can try the directions from the following blog which gave me the idea to try this for non-ssl ports.

3 comments:

r4 ds said...

Nice post. I am new at developing. the article you provided link was good and helped me a lot for my project. Keep posting. will be visiting back soon.

Josh Berke said...

@r4 ds: I'm glad I could help that's exactly why I do this. Good luck on your project

dan said...

do you have any clue how to do this when it's accessed via a reverse proxy?

We have a machine in the DMZ which is accessed via the internet.. then I use a reverse proxy to access the biztalk server with WCF service..