ujjaval
ujjaval

Reputation: 1533

Update Service Reference is not working in WCF

I am using VS 2012.

I add services reference to my WPF project, but when I've changed my services and updated service reference my Reference.svcmap -> Reference.CS file will be blank and I can't use reference anymore. I can see it in project, but I can't use.

My settings of Services References are :- enter image description here

Reference.cs file

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.17929
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

Upvotes: 25

Views: 41646

Answers (6)

Damith
Damith

Reputation: 63065

There are few things you can do first Clean the solution, delete the output directory and the service reference. Restart the Visual Studio and re configure the web service.

Upvotes: 1

Orlando Seixas
Orlando Seixas

Reputation: 81

It can be caused by Team Foundation source control. Try to right click on the service ref and choose "Check out for edit..." Than update service reference again.

Upvotes: 0

gatsby
gatsby

Reputation: 1229

Unchecking the reuse option the Update Service option works fine.

Upvotes: 1

Dhivya DD
Dhivya DD

Reputation: 73

While configuring service reference append /mex (address of your end point with mexHttpBinding ) at the end of your service URL.

https://service.domain.com/serivce1.svc/mex

This will enable metadata exchange. So Reference.cs will be modified / added (if you are adding service reference for the first time).

Edit : On analysis I found that this issue happens when a service (which implements one ServiceContract) is exposed via more than one end point.

This issue can be avoided by using different Service Contracts (Interface) for each end point and making the service class (service1) implement all these Interfaces.

Upvotes: 4

Abhishek B Patel
Abhishek B Patel

Reputation: 935

uncheck the Reuse types in referenced assemblies checkbox and put address of your new service in Address textbox.

Upvotes: 30

alan
alan

Reputation: 6943

If you cannot browse the URL, then you will not be able to add the service reference. Try hosting your web service locally in IIS. When you're able to browse the URL, then you can add the service reference.

Upvotes: 3

Related Questions