Reputation: 10779
I have a MVC 4.0 project. The structure looks like this.
MySolution
BLL
DAL
MyProj
MyAPIProj
DAL
contains the .edmx
.
BLL
contains the services that talk with DAL
and Models to retain the data.
MyProj
has controllers and views. Also, it has reference to the DAL and BLL.
All the above mentioned projects are under one solution.
Now the requirement is : we are trying to create a new layer of abstraction using Web API. Instead of the controllers in MyProj
talking to the BLL
we want to create a WebAPI and Myproj
will call the WebApi
and after basic validation the WebApi
will talk to the BLL
and based on the input received by the BLL
the response will be sent back to the WebAPI
and then to MYProj
.
Now from MyProj
I am making an .ajax call to MYAPIProj
and in MYAPIProj
i have reference to the BLL and DAL. My question is
I need both applications to use the same port. Is there a way to do that in Visual Studio?
If not, what would be the best way to make it work locally.
Upvotes: 2
Views: 721
Reputation: 4054
You can use Host Headers in IIS (locally and on the server) and do something like:
app.mydomain.com
api.mydomain.com
Host Headers in IIS 7: http://technet.microsoft.com/en-us/library/cc753195(v=ws.10).aspx
Or you can create the API as an application within your main app so it would look like:
api.mydomain.com/service/ (where service is the application)
Upvotes: 1