Search code examples
wcfasp.net-mvc-4visual-studio-2012

I cannot add service reference(WCF library) to MVC4 in VS2012


My problem is very simple, but unfortunately I cannot figure out what's wrong. I've created a new MVC4 Internet Application project with Razor syntax, then I added another WCF Library project to this solution. I did not make any change on these codes. However, as I added the WCF project as a service reference in the MVC 4 app, I'm getting 1 Error message and 3 Warning messages:

  1. Error 4 Custom tool error: Failed to generate code for the service reference 'ServiceReference1'. Please check other error and warning messages for details. c:\users\vendre\documents\visual studio 2012\Projects\MvcApplication3\MvcApplication3\Service References\ServiceReference1\Reference.svcmap 1 1 MvcApplication3
  2. Warning 1 Custom tool warning: Cannot import wsdl:portType Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter Error: Could not load file or assembly 'DotNetOpenAuth.AspNet, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246' or one of its dependencies. The system cannot find the file specified.
  3. Warning 2 Custom tool warning: Cannot import wsdl:binding Detail: There was an error importing a wsdl:portType that the wsdl:binding is dependent on. XPath to wsdl:portType: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:portType[@name='IService1']
  4. Warning 3 Custom tool warning: Cannot import wsdl:port Detail: There was an error importing a wsdl:binding that the wsdl:port is dependent on. XPath to wsdl:binding: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:binding[@name='BasicHttpBinding_IService1']

I read some article but did not resolved my problem. If somebody know the answer for my problem, please tell me.

THX.


Solution

  • When you add the reference, on advanced setting remove the reuse types checkbox.