4

What using statements do I need to get at the ServiceReference1 object in ASP.NET MVC4 application?

The ServiceReference1 here is the name of my service reference that I added. What's weird, is that if I double click on it, it doesn't bring up anything in the object browser...

Update: For some reason "Unchecking "Reuse types in referenced assemblies"" solves my problem!

enter image description here

dove
  • 20,469
  • 14
  • 82
  • 108
Andriy Drozdyuk
  • 58,435
  • 50
  • 171
  • 272

2 Answers2

5

To add to your update, when you uncheck instead of all Reuse Types in referenced assemblies just uncheck what you need.

Not sure if there's much more you are looking for

dove
  • 20,469
  • 14
  • 82
  • 108
  • Thanks, I'm actually investigating a completely different approach to services based on this video: http://dnrtv.com/dnrtvplayer/player.aspx?ShowNum=0122 – Andriy Drozdyuk Oct 05 '12 at 15:18
  • Cool. Not a bad idea to take a step back from a problem sometimes. – dove Oct 05 '12 at 15:28
1

I've found that sometimes it gets confused if you have a namespace like MyProject and a service reference called MyService, but the code file that you're typing in is in something like MyProject.AnotherNS. From that code file, you'd have to type MyProject.MyService to access the service, not just MyService. The super-safe way to get this to always work is to use the global keyword, and type something like global::MyProject.MyService. global just removes any implied prefix(es) from the namespace while in a block of code.

Matthew Kennedy
  • 616
  • 4
  • 19