locked
Consuming a Service Reference. RRS feed

  • Question

  • I added a service reference to my WCF TCP service. It seems to have created the reference fine, but when I attempt to use the proxy in my code, it does not recognize the namespace. The same code works in VS 2010.

     

    Any thoughts? 

    Monday, January 9, 2012 6:22 PM

Answers

  • If the Reference.cs file is empty except for the comment header then the proxy generation failed.

    I found that proxy generation failed for the following reasons:

    • A binding had reliable session enabled
    • A custom binding had a security node defined
    • A service behavior added a policy type
    • A service contract defined fault contracts

    To get things to work I did not enable the reliable session.

    I had to remove the fault contracts from the service contract.

    For the middle two issues I removed them from the service configuration, started the service, generated the proxy, stopped the service, put the entries back into the configuration and restarted the service.

    Hopefully the next version of the proxy generator won't have these issues.

    Wednesday, January 11, 2012 6:04 PM

All replies

  • Anyone?
    Wednesday, January 11, 2012 2:55 PM
  • Can you post your WSDL here?  Did you add the service reference inside of Visual Studio or are trying to add the reference in another manner?

     


    Jeff Sanders (MSFT)
    Wednesday, January 11, 2012 4:34 PM
    Moderator
  • Are you using the namespace specified in the generated Reference.cs file?
    Wednesday, January 11, 2012 5:14 PM
  • I created the service reference through visual studio. I provided the address to my server running the wcf service.
    I did find a Reference.cs file in the service reference subfolder, but it is not added to my project and it is completely empty except for some comments.
    The WSDL is too large to post. Can I email it to someone?
    Thanks!
    Wednesday, January 11, 2012 5:38 PM
  • If the Reference.cs file is empty except for the comment header then the proxy generation failed.

    I found that proxy generation failed for the following reasons:

    • A binding had reliable session enabled
    • A custom binding had a security node defined
    • A service behavior added a policy type
    • A service contract defined fault contracts

    To get things to work I did not enable the reliable session.

    I had to remove the fault contracts from the service contract.

    For the middle two issues I removed them from the service configuration, started the service, generated the proxy, stopped the service, put the entries back into the configuration and restarted the service.

    Hopefully the next version of the proxy generator won't have these issues.

    Wednesday, January 11, 2012 6:04 PM
  • Great... I'm using reliable sessions. Any chance this will be fixed for the Win8 Beta?

    Thanks for the workaround Terry.

    Wednesday, January 11, 2012 6:47 PM
  • Hi D,

    It is known that wsHttpBinding (which is used for reliable sessions) is not included in current release.  We cannot speculate about or divulge any features that have not been publically released.

    -Jeff


    Jeff Sanders (MSFT)
    Wednesday, January 11, 2012 8:00 PM
    Moderator
  • Hi Jeff,

    In my case I'm using the netTcpBinding which is included in the current release but enabling reliable sessions in that binding doesn't seem to be supported.

    Wednesday, January 11, 2012 8:25 PM
  • Yes, reliable sessions will not work for any binding.
    Jeff Sanders (MSFT)
    Wednesday, January 11, 2012 8:27 PM
    Moderator