Click here to Skip to main content
15,889,335 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a asp.net solution that contains several web apps. When deployed, the main app can run the other apps (via a url of course). Is is possible to run them locally on localhost?

What I have tried:

Nothing but copious googling and hoping for the best. Maybe my google foo is not effective today.
Posted
Updated 28-Jan-19 4:30am
Comments
Richard Deeming 28-Jan-19 7:33am    
Are you looking for multiple startup projects[^]?
#realJSOP 28-Jan-19 7:43am    
No. I want to be able to click a link in one web app that runs another web app in the solution.
ZurdoDev 28-Jan-19 8:06am    
I don't quite follow. "Run" a web app really just means go to a url. So, yes, certainly you can go to any url.
#realJSOP 28-Jan-19 8:26am    
By "run an app", I mean click a link and have it start. When you run a web app in VS, the url is localhost:nnnnn. To my knowledge, you can't set a url (in a link) to "localhost:nnnnn" and have IIS express understand what you mean ("run this app over here").
ZurdoDev 28-Jan-19 8:28am    
No, you would go into VS and right-click your project, properties, click the Web tab and then put in a specific Start URL with a port. Then go into IIS and configure the site on that port. In other words, set it up in IIS so that it is always the same port instead of letting VS control it and getting different ports numbers.

1 solution

A website needs to be hosted in a unique host\port configuration so "localhost" is really "localhost:80" as it defaults to 80. If you want to run multiple sites on the same server you need to either give them unique ports or unique hosts (or both). So you have to give each site a fixed port and always use that port and any links to that site would be in the format

localhost:xyz/somepage

In IIS you'd then create a website for each one and bind it to the relevant port. The alternative is to give each its own host, so you would have

sitea/somepage

and so on, and again in IIS create each site and bind it to your given host. Your problem then is making that host resolve to the target machine. If this is localhost for testing then you can amend your hosts file to configure each host to resolve to 127.0.0.1
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900