Access controller of another project in the same solution

2

Personal I have 3 projects in the same solution: KnockDocWeb, KanoDockModels and KnodockApi as shown below:

When I compile the project it starts KanoDockWeb, however I want to access a controller that is in KanoDocApi by KanoDockWeb.

I want to access a controller called UserApiController and the Login method;

I want to know, in the URL how do I access that controller?

I've already tried:

localhost:18459/UsuarioApi/Login
localhost:18459/api/UsuarioApi/Login
localhost:18459 /KnockDocApi/UsuarioApi/Login

No one was successful.

One more thing:

When I give a brakpoint to any KnockDocApi controller I get the following message: The breakpoint will not currently be hit. No symbols have been loaded for this document.

Just pointing out that KanoDockApi is a Web Api project

Please, somebody help me ???

Thank you in advance.

    
asked by anonymous 28.05.2016 / 18:45

1 answer

1

Robson, you are working with 2 projects of the Web Application type, to run, they would need to be published (on a web server or a virtual web server like you are doing there). What you are wanting to do is the same as 2 websites communicate and exchange information. In order to run the 2, you would have to open a port for each application. But even then, it would not be possible to make these calls, only independent. Your attempts do not work because KnockDocWeb is running on port 18459, not KnockDocApi. I advise you to create a new Class Library type project that will contain the logic of this controller you need to call. So it can be shared on both web sites.

    
31.05.2016 / 22:48