4
votes

I have created a WCF service on my local machine. My local machine uses Windows 7 RC1, thus the web server is IIS 7. However, my production machine is a Windows Server 2003 using IIS 6.

When I attempt to reference the service in my local environment, everything works fine. However, when I promote my service to my production machine, and try to reference the service, I receive an error. The error says:

Error: Cannot obtain Metadata from http://www.thedomain.com/theService.svc?wsdl

If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address. For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455.

WS-Metadata Exchange Error URI: http://www.thedomain.com/theService.svc?wsdl

Metadata contains a reference that cannot be resolved: 'http://www.thedomain.com/theService.svc?wsdl'.

Content Type application/soap+xml; charset=utf-8 was not supported by service http://www.mydomain.com/myService.svc?wsdl. The client and service bindings may be mismatched.

The remote server returned an error: (415) Cannot process the message because the content type 'application/soap+xml; charset=utf-8' was not the expected type 'text/xml; charset=utf-8'..

Is there something I need to do in IIS 6 to get a WCF service to work? I'm really confused as to why it works fine locally, but not fine in production.

Thank you!

2

2 Answers

3
votes

There are 4 possibilities I can think of:

  • Some security setting that is blocking access the the service. Check you IIS log for access denied
  • That the configuration of the services web.config has not been transfered to production
  • That metadata exchange is not configured with http get allowed
  • That you are using a newer binding that is not supported on IIS 6

The bindings that are supported by IIS 6 are basicHttpBinding and wsHttpBinding. See:

http://msdn.microsoft.com/en-us/library/cc949086.aspx

Hope this helps

2
votes

You have locked onto the obvious difference between the two environments - one is running IIS 6 and the other is running IIS 7. That may be a difference, but not the difference that is causing the problem.

Have you compared the web.config files in the two environments?

Judging from the error messages, it looks like WCF is running on the production machine, but that there's a problem with getting the metadata. Have you tried running the service in production? It's possible that running it will work, even if metadata retrieval does not work.


Also, if you don't mind me getting a little philosophical here, you've just found the reason for staging servers. The fact is that there's a much greater difference between "1" and "2" than there is between "2" and "3". Moving from the development environment directly to production, you're encountering issues with "multiple environments" for the first time. This is similar to the difference between singular and plural.

You're also encountering issues with "different environments" for the first time. this is similar to the difference between "same one" and "different ones".

Adding a staging system in the middle gives you the chance to get all these issues out of the way ahead of time, so that when you move from staging to production, you may still have the issue of "difference", but you will not have the issues of "singular vs. plural" again - you will already have resolved them.