9
votes

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.

3
Yes I did, I tried that all the collection type, but the problem still exists. Thank you for your suggestion.Vajda Endre
The error is pretty clear: Could not load file or assembly 'DotNetOpenAuth.AspNet - so make sure you have that/those file(s) available when you add that service reference...marc_s

3 Answers

38
votes

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

3
votes

If you're experiencing this problem in 2021 with VS2019. Add a folder to the project called "Connected Services"

0
votes

If using VS 2019, check if in Solution Explorer you see "Service Reference". Than edit the project file for following

<ItemGroup>
  <WCFMetadata Include="Connected Services\" />
</ItemGroup>