Question

I have created a test web service and that works. I can access it with the web browser (both from local machine and from remote machine), I can connect to it both with a windows form app and a smart device app but smart device app works and windows form app doesn't (disconnects from web service unexpectedly etc etc).

So I've decided to have a look at WCF instead.

Created a simple WCF service app (from VS2008 new project->vc#->web->wcf service app, build, publish and at first it failed using my LAN IP (10.1.1.250) but then I used http://localhost/WCFService1 and it's ok, it publishes successfully.

I browse to it with my browser at http://localhost/WCFService1 and can see files. Click on Service1.svc and it gives me errors XML format invalid, figured .svc was missing in the WCFService1 app on IIS. Funny but it's defined on "Web Sites" but not on "Default web site" or "WCFService1" app. So added that, now Service1.svc gives me the help page for it, tells me about wsdl, if I click on wsdl it gives me a nice wsdl output page, so everything checks.

I browse to it with my browser from another machine on the LAN and again, everything checks. So it's there.

Now I go back to VS2008 and create a windows forms app. Go to project->add service reference, enter http://localhost/WCFService1 and it bombs out telling me that "An error occurred while attempting to find services at http://localhost/WCFService1/" and Details shows:

The HTML document does not contain Web service discovery information.Metadata contains a reference that cannot be resolved: 'http://localhost/WCFService1/'.The remote server returned an unexpected response: (405) Method not allowed.The remote server returned an error: (405) Method Not Allowed.If the service is defined in the current solution, try building the solution and adding the service reference again.

The document at the url http://localhost/WcfService1/Service.svc was not recognized as a known document type.The error message from each known type may help you fix the problem:- Report from 'DISCO Document' is 'There was an error downloading 'http://biber/WCFService1/Service.svc?disco'.'. - The request failed with the error message:--<?xml version="1.0" ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head> <title>Server Unavailable</title> </head> <body> <h1><span style="font-family:Verdana;color: #ff3300">Server Application Unavailable</span></h1> <p> <span style="font-family:Verdana;"> The web application you are attempting to access on this web server is currently unavailable. Please hit the "Refresh" button in your web browser to retry your request.</span></p> <p> <b>Administrator Note:</b> An error message detailing the cause of this specific request failure can be found in the application event log of the web server. Please review this log entry to discover what caused this error to occur. </p> </body></html>

--.- Report from 'WSDL Document' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.- Report from 'http://localhost/WcfService1/Service.svc' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.- Report from 'XML Schema' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.Metadata contains a reference that cannot be resolved: 'http://localhost/WcfService1/Service.svc'.The underlying connection was closed: The connection was closed unexpectedly.The underlying connection was closed: The connection was closed unexpectedly.If the service is defined in the current solution, try building the solution and adding the service reference again.

Metadata contains a reference that cannot be resolved: 'http://biber/WCFService1/Service.svc?wsdl'.There was an error downloading 'http://biber/WCFService1/Service.svc?wsdl'.The request failed with the error message:--<?xml version="1.0" ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head> <title>Server Unavailable</title> </head> <body> <h1><span style="font-family:Verdana;color: #ff3300">Server Application Unavailable</span></h1> <p> <span style="font-family:Verdana;"> The web application you are attempting to access on this web server is currently unavailable. Please hit the "Refresh" button in your web browser to retry your request.</span></p> <p> <b>Administrator Note:</b> An error message detailing the cause of this specific request failure can be found in the application event log of the web server. Please review this log entry to discover what caused this error to occur. </p> </body></html>

--.Metadata contains a reference that cannot be resolved: 'http://localhost/WcfService1/Service.svc?disco'.Metadata contains a reference that cannot be resolved: 'http://localhost/WcfService1/Service.svc?disco'.If the service is defined in the current solution, try building the solution and adding the service reference again.

And that's where I start from scratch, delete everything (including the IIS WCF app), re-create the WCF service, re-publish it, try to re-connect to it from a brand new simple app, and fail, and have been doing it for the past two days. I'll start crying soon.

Have I mentioned that I've tried adding and removing things from Web.config? Yes I have. I've also tried changing the way IIS authentication works, from Anonymous disabled, to anonymous enabled with HOST\Administrator, Administrator, HOST\Username, Username, let IIS manage passwords, type in a password, with windows authentication, without windows authentication, practically I've tried everything. Well obviously not everything as it's not working. What else can I try?

Basically trying to switch from web services to WCF services turned out to be a config nightmare and I thought it was going to be easy.

YES, <serviceMetadatahttpGetEnabled="true"/> and has allways been that way.

I can post my Web.config if you want but it's basically whatever VS2008 generates by default when you create a WCF service app.

All replies

Did I mention that I've been combing with a fine brush through this forum to find a solution for the past few days but still no luck? I firmly believe that my problems lie within IIS somewhere but can't see it. I did go through that tutorial on enabling your IIS for WFC and deploying WFC to IIS still no luck. And just to remind everything - Web services work, WCF don't. Both Web services and WCF services give me output on the browser, they both give me ?wsdl and ?disco output, just can't add service reference to WCF.

Also, if I go back to my WCFService project and click on Add service reference from within that project and click on discover it does find the very WCFService on the local dev server (http://localhost:3395/WCFService1/Service.svc) and gives me access to the service. So IIS config problem definitely. Any IIS + WCF experts out there that can guide me through the steps of re-configuring IIS for WCF?

i am also facing a similar problem when i host my wcf application on godady. it works perfectly locally, but then when i try to deploy it on godaddy and go to this url : http://myhost.com/myWCFService.svc it gives me the following error.

XML Parsing Error: no element found Location: http://myhost.com/myWCFService.svc Line Number 1, Column 1:

I needed to add an httpHandler to my web.config for the svc extension. On all my home computers and my work computer this entry already existed in C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\web.config, but apparently it doesn't exist in godaddy's. I added the correct handler and my service came right up.

This typically occurs if ASP.NET is not installed or the .svc file type is not mapped to the aspnet_isapi.dll.

To correct this you must make sure that aspnet_isapi is enabled as a Web service extension for IIS. You can view and modify this setting using IIS Manager, or by runningaspnet_regiis –i –enable from the .NET Framework installation directory. Once you have done so, verify that ASP.NET is running. To do so, place a test .aspx file in the \inetpub\wwwroot directory, and make sure it can be browsed with a browser.

If you installed IIS after Windows Communication Foundation (WCF) was installed you must run the following command.

Im also suffering from this problem. I tried some of the suggestions and end up with the error below

The document was understood, but it could not be processed. - The WSDL document contains links that could not be resolved. - There was an error downloading 'http://pc-name/TestWCF/MyService.svc?xsd=xsd0'. - The request failed with HTTP status 404: Not Found.

You have to add clientacesspolicy.xml to your project . i had the same issue for a silverlight application,the Ui was working great but the WCF part wasnt working then i researched and added clientaccesspolicy.xml to the project and it worked fine for
me then onwards.if you still have issues then try changing the integrated security specification in the web.config with the username and the PWD of your DB. guess that should do the trick