Access another project’s controller in the same Solution

Asked

Viewed 467 times

2

Guys I have 3 projects in the same Solution: Knockdocweb, Kanodockmodels and Knodockapi as shown in the image below:

inserir a descrição da imagem aqui

When I compile the project it starts Kanodockweb, but I want to Access a Controller that is in Kanodocapi by Kanodockweb.

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

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

I’ve already tried:

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

None I have succeeded.

One more thing:

When I give a brakpoint on any Knockdocapi controller I have the following message: The breakpoint will not Currently be hit. No Symbols have been Loaded for this Document.

Just noting that Kanodockapi is a Web Api type project

Please, somebody help me???

Thank you in advance.

  • A project makes using from the other? How are you doing with Service Locator?

1 answer

1


Robson, you’re working with 2 Web Application projects, to run, they would need to be published (on a web server or a virtual web server as you’re doing there). What you want to do is the same as 2 websites communicate and exchange information. To be able to run the 2, you would have to open a door for each application. However, it would still not be possible to make these calls, only independent. Your attempts don’t 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. Thus, it can be shared on both web sites.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.