I have an ASP.NET MVC application that communicates with a WCF service hosted locally. Currently, I consume the WCF service using a Service Reference added via Visual Studio.
The problem is: every time I close and reopen my ASP.NET MVC project, I have to delete the existing service reference and add it again to avoid errors and outdated metadata issues. This breaks my workflow and is very frustrating.
I want a stable solution that allows me to call the WCF service without needing to re-add the service reference repeatedly.
How can I properly consume the WCF service in my ASP.NET MVC app so that the client proxy doesn’t require re-adding every time I reopen the project?
Here's what I currently do in the controller:
using (var client = new SubmissionServiceClient())
{
var result = client.SubmitForm(model);
// ...
}
But this causes issues after closing and reopening the project.