Search code examples
c#asp.net-mvcwcf

Use WCF service in MVC


I want to use the WCF service of another application in the MVC web application, but so that the address of this service is in the web.config file.

WCF has a method of generating documents it wants to use in MVC. However, the service address must be in the web.config file because we have several environments. This file is replaced for each environment and thus the service address changes.

I am asking for some advice / tips on how to do this.


Solution

  • This work

    If your MVC project is .NET Framework you right click References and choose Add Service Reference. It will create a Service Model Section in your web.config. if your project is .NET core or above do this –  Crowcoder