Recently I had to add a web service to a project. While I have done this many times, this time was different. As always, I created a web service, configured it correctly and I was able to open it in the browser. It showed me the page that explains that you need to create the client, etc (thus, the web service itself is reachable).
Problem:
Then, I used “Add new service reference…” in my client project and used the correct URL. But, after adding the webservice, the reference.cs looked like this:
//------------------------------------------------------------------------------// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.239
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//-----------------------------------------------------------------------------
If you don’t know how to view the reference, use the “Show All Files” button on the Solution Explorer toolbar. Then you can expand the service reference, then expand Reference.svcmap and you will see the Reference.cs file which is your generated proxy.
But, why on earth is my proxy empty? I am very sure I have methods that should appear here.
Solution:
You are probably already pulling your hair out and tried everything in your power to solve this issue. Here is the solution:
- Clean the solution
- Delete the service reference
- Build the Solution
- Re-configure the web service reference (make sure you select to: "Always generate message contracts")