Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Named Pipes references not working with ASP.NET MVC 4

I'm working on a API and using ASP.NET Web API in order to expose it. I tried to add a service reference to a Named Piped service that is responsible for authentication and authorization, but I couldn't reference it on my code.

That Named Pipe service is working properly and is used on a wide variety of projects. That is the first time we try to use it with ASP.NET MVC 4. It's working very well on another project that uses ASP.NET MVC 3.

Like you could see on the following image, I'm able to add the service reference. But It didn't appear on Object Browser or auto-complete!

Service References

When I try to invoke that service, it just does not show up anywhere.

Code

It appears to be a problem with ASP.NET MVC 4 projects and Named Pipes service references.

I really don't know if that is a well know / documented behavior, but I wasn't able to find anything useful related to that question on the internet.

I could add a reference to that service using Visual Studio 2012 on any kind of project, except ASP.NET MVC 4 ones. The problem is specifically related to ASP.NET MVC 4 projects.

I tried to add the reference using Visual Studio 2010 and I had the same problem: working pretty well with ASP.NET MVC 3 and any other kind of project. Again, the problem is specifically related to ASP.NET MVC 4 projects.

Is anyone having the same problem? How could I go through it?

like image 818
Glauco Vinicius Avatar asked Nov 23 '12 20:11

Glauco Vinicius


1 Answers

Since it appears to be a Visual Studio / ASP.NET MVC bug I just found an workaround.

I just figure out that I could use svcutil command line tool in order to generate the code for service client and data structures. Here are the syntax for the command:

> svcutil net.pipe://my_sevice/mex /namespace:"*, MyNamespace"

It generated the following files:

  • SecurityService.cs
  • output.config

Then I just imported the generated SecurityService.cs file into my current project and did a merge of the binding configurations available on the generated output.config with my own web.config.

like image 96
Glauco Vinicius Avatar answered Nov 15 '22 07:11

Glauco Vinicius