简体   繁体   中英

Host a Web application and Web API Project that Use IP Address on Two different Web Servers

Current Scenario that works well: I have a .NET solution that contains 2 projects - Web Application and a Web API Project. When I need to Publish - I am publishing Web Application first and then Web API project on the Web Server. I am using IP Address to Communicate from Web Application to Call Web API Controllers.

The client now needs this Application to be published to two different web servers that of course have different IPs.

How do I publish because I am using an IP address that is different for both the web servers? Even if I use hostname/server name, I would get into the same issue of both being different.

Will you have 2 different databases? I didnt not understand you clearly what is the problem here, if you host Web Application on serv1 and Web API on serv2, Web Application will use serv2 IP address to access the Web API, usualy Web API does not need to access to the Web application since is used just to store and revive data from someware but if u need to push something to the Web Application, Web API will use serv1 IP address to access.

If the WebApp is in angular/react then create the build from VS Code or whichever ide you are using.

If as WebApp you are using Razor/Mvc then remove all the references and then at every call instead of having the call directly have a web api call.

Web Api can be published independently if no references are attached to it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM