locked
Getting 415 error when trying to run SvcUtil against the WCF service RRS feed

  • Question

  • I'm trying to get back to writing an app, which will use the WCF service (ASIService) I wrote over a year ago, and put on a Windows 2003 Server.  The WCF service I wrote uses TCP, so I wrote a Windows service to host it.  Unfortunately for me, other projects/priorities have come up since and I'm only now able to get back to it.

    I wrote the WCF service using VS 2008.  Now, I'm trying to use VS 2010, .NET 4, instead.  I've run SvcUtil.exe, both from the VS 2010 and the VS 2008 command prompts, and gotten the same error message.  Here is the error message:

    WS-Metadata Exchange Error
    URI: http://helios:9001/ASIService?wsdl

    Metadata contains a refernce that cannot be resolved: 'http://helios:9001/ASIService?wsdl'

    Content Type application/soap+xml; charset=utf-8 was not supported by service http://helios:9001/ASIService?wsdl.  The client and service bindings may be mismatched.

    The remote server returned and 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'.

    HTTP GET Error

    URI: http://helios:9001/ASIService?wsdl

    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://localhost:9001/ASIService?wsdl=wsd10'.
    • Unable to connect to the remote server
    • No connection could be made because the target machine actively refused it 127.0.0.1:9001

    I've been looking up this error and found that sometimes SvcUtil.exe complains because it's expecting a content type of 'application/soap-xml; charset=utf-8', which is what mine is producing, but then other times SvcUtil.exe is expecting a content type of 'text/xml; charset=utf-8', which is what in my case it is expecting.  Anyway, it's difficult when it expects one thing, one time, but then the opposite thing, another time.


    Rod
    Wednesday, April 20, 2011 5:25 PM

All replies

  • this error should not happen when you use svcutil. can you see the wsdl in IE?
    http://webservices20.blogspot.com/
    WCF Security, Interoperability And Performance Blog
    Wednesday, April 20, 2011 6:36 PM
  • When I go to http://helios:9001/ASIService I get the following page:

    Service1 Service

    You have created a service.

    To test this service, you will need to create a client and use it to call the service. You can do this using the svcutil.exe tool from the command line with the following syntax:


    svcutil.exe http://localhost:9001/ASIService?wsdl

     

    This will generate a configuration file and a code file that contains the client class. Add the two files to your client application and use the generated client class to call the Service. For example:

    C#

    class Test
    {
      static void Main()
      {
        Service1Client client = new Service1Client();
    
        // Use the 'client' variable to call operations on the service.
    
        // Always close the client.
        client.Close();
      }
    }
    

    Visual Basic

    Class Test
      Shared Sub Main()
        Dim client As Service1Client = New Service1Client()
        ' Use the 'client' variable to call operations on the service.
    
        ' Always close the client.
        client.Close()
      End Sub
    End Class

    However, if I click on the link: http://helios:9001/ASIService?wsdl I get a page that says, "Internet Explorer cannot display the page".  So, if I've understood your question correctly, then I'd have to say no, I can't see the wsdl.


    Rod
    Wednesday, April 20, 2011 7:47 PM
  • in this case turn on wcf trace:

    http://blogs.msdn.com/b/madhuponduru/archive/2006/05/18/601458.aspx

    and see what error the service has when trying to generate the wsdl. svcutil is not the problem, the service error is


    http://webservices20.blogspot.com/
    WCF Security, Interoperability And Performance Blog
    Wednesday, April 20, 2011 10:53 PM
  • Hi Yaron,

    I've gone to the link you specified, but am not certain how to proceed.  According to the linked to article, the first thing I'm to do is open a config file using svcconfigeditor.  Well, at this point there isn't a config file.  Am I missing something?


    Rod
    Thursday, April 21, 2011 4:42 PM
  • don't you have web.config in your server? if not (which I doubt) create one.
    http://webservices20.blogspot.com/
    WCF Security, Interoperability And Performance Blog
    Thursday, April 21, 2011 10:11 PM
  • You are missing the serviceMetadata HttpGetEnabled = "true" behavior and/or Mex endpoint for the service configuration.

    Friday, April 22, 2011 10:10 AM
  • don't you have web.config in your server? if not (which I doubt) create one.
    http://webservices20.blogspot.com/
    WCF Security, Interoperability And Performance Blog

    Ah, OK, I see what you're saying now.  OK, I'll go to the server and run svcconfigeditor there.
    Rod
    Friday, April 22, 2011 2:43 PM
  • I just tried running SvcConfigEditor.exe on the server. It wouldn't run there. I then searched for it on that server and found that it is not there. Now what do I do?
    Rod
    Monday, April 25, 2011 8:54 PM