0
votes

I have wcf iis hosted service. I've created standard(from vs template) wcf service and its client. At client I add ServiceReference to my wcf service. All is good. No errors, web-form for this server works too. Next step I publish my wcf service to Win2003 IIS6.0. I successfully go to http://server:1234/Service1.svc, see web-form, can check wsdl. But when i run: svcutil.exe http://server:1234/Service1.svc?wsdl or add service reference I've got errors:

Error: Cannot obtain Metadata from http://server:1234/Service1.svc?wsdl

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

WS-Metadata Exchange Error URI: http://server:1234/Service1.svc?wsdl
Metadata contains a reference that cannot be resolved:
'http://server:1234/Service1.svc?wsdl'.
The remote server returned an unexpected response: (417) Expectation failed.
The remote server returned an error: (417) Expectation failed.

At my service config I have:

endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
serviceMetadata httpGetEnabled="true"/>

I can't understand problems. Can you help me. Thanks a lot

2

2 Answers

0
votes

Edit:

This answer was posted and isn't specifically useful to this question (any more) as it was based around a typo in the original question. That being said I still feel the information is useful here for people with similar problems that are likely to find this question in a search for their answer. If someone with the authority to remove answers feels that this needs removed - please feel free to remove it.


Original answer:

I'm not sure if this is helpful or not - I'm having a similar problem. Please notice that while you are accessing http://server:1234/Service1.svc ... further down in the error message it mentions that MEX endpoint is http://aurit-server:1234/Service1.svc... then, depending on how you have your bindings setup, it may be that aurit-server is not a valid endpoint for your service MEX... but server is or vice versa.

I know this isn't the full answer for you, I'm just pointing out something that I overlooked while troubleshooting my similar problem - hope it helps. I.e. aurit-server and server may not be interchangeable... they were not interchangeable in my case.


Edit:

Btw since posting this I've recieved an answer to a similar question that I posted. I strongly suggest you check it out incase it fixes your issue. Summary: It links to a blog post that details how to fix the issue I mentioned in my original 'suggestion' to you. If it helps you please make sure you vote Chesso up! (Chesso's answer to me, Blog post referenced in Chesso's answer).

0
votes

I had this problem ("The remote server returned an unexpected response: (417) Expectation failed") when trying to add a service reference to a WCF service I'd deployed on another server. Turned out to be internet properties in this case.

  • Go to control panel -> internet properties, "Connections" tab.

  • Click the "LAN settings" button.

  • Uncheck "Automatically detect settings" and "Use automatic configuration script".

  • Click OK, apply / OK.

After that, I could add the service ref just fine. Worth a try if you have this problem.