Monday, June 3, 2013

Accessing Service Reference in MVC Controller

When we add a service reference to a MVC application & then try to access it from a controller that type is not accessible in that. To get the service reference accessible in the code follow the following steps when adding the reference.

1. Click on the Advanced Settings Button in the Add Service Reference dialog.


2. Unselect the “Reuse types in referenced assemblies” option


I QUOTE this from Guy Kolbis' blog:

Reuse types in referenced assemblies” means

"Basically it determines whether a WCF client will try to reuse that already exist in referenced assemblies instead of generating new types when a service is added or updated. By default, this option is checked."


Happy Coding !!