Vajda Endre
Vajda Endre

Reputation: 1570

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.

Upvotes: 16

Views: 16541

Answers (7)

Eva Buchet
Eva Buchet

Reputation: 101

You can try the following :

  1. Delete the "Connected Services" folder from the project in Visual Studio
  2. Add the service reference with right-click on the project / Add / Service Reference... It should work and recreate the "Connected Services" folder with your new service reference.

Upvotes: 2

zenlty
zenlty

Reputation: 41

In Visual Studio 2022, You need to create a folder "Connected Services" in project path, via Windows Explorer, not Visual studio solution explorer'

Like this

Upvotes: 3

NoobDev
NoobDev

Reputation: 51

In Visual Studio 2019, I fixed the error (system cannot find path specified) by creating a new folder named "Connected Services" inside project folder

Upvotes: 5

MİRAÇ
MİRAÇ

Reputation: 101

sometimes you need to create a folder "Service References" in project path. If you dont have this folder it should gives this path error.

Upvotes: 10

Amitabh
Amitabh

Reputation: 31

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>

Upvotes: 3

Evan Parsons
Evan Parsons

Reputation: 1209

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

Upvotes: 23

Vajda Endre
Vajda Endre

Reputation: 1570

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

Upvotes: 41

Related Questions