Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can't access the added service reference

I've added a service reference to my mvc4 web project and left it with the default namespace "ServiceReference1", but when I wanna use that namespace, visual studio can't find it, like it doesn't exist, the webservice is up and working fine. What exactly am I doing wrong?

like image 648
arash moeen Avatar asked Apr 09 '14 13:04

arash moeen


People also ask

How do I add an existing service reference?

You have to right-click on project -> Add... -> Service reference and then paste path to wsdl file. Do this for each service. Also if your both projects are in one solution, you can just add a reference to project containing this services and generated code will be shared between projects.

How do I add a service reference in net standard project?

(For a . NET Core or . NET Standard project, this option is available when you right-click on the Dependencies node of the project in Solution Explorer and choose Manage Connected Services.) On the Connected Services page, select Add Service Reference.

How do I change my Asmx service reference?

In Solution Explorer, open your project's App_WebReferences folder and click the node for the Web reference you want to update. Right-click the reference and click Update Web Reference. The new files for the XML Web service are downloaded to your project.


2 Answers

I found the solution HERE which as Hoakie mentioned below instructions worked for me and my reference.cs is generated properly now:

1) Right click on Service Reference

2) Select Configure Service Reference

3) Uncheck "Reuse types in referenced assemblies"

and Voila!

like image 56
arash moeen Avatar answered Oct 05 '22 17:10

arash moeen


This is caused by having the same namespace name as class name.

Change your namespace to a name that is not the same name as your class and this will compile

like image 23
Sai Avinash Avatar answered Oct 05 '22 17:10

Sai Avinash