Reputation: 13722
Background:
I have a Visual Studio solution consisting of a website + REST web-service that I'd like to split into a web services project and a web site project.
Currently, the web service is kicked off during application startup via App_Code\global.asax.cs
, with the following code:
public class Global : System.Web.HttpApplication
{
void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup
RouteTable.Routes.Add(new ServiceRoute("api/", new WebServiceHostFactory(), typeof(myWebInterfaceSvc)));
}
// more code here
}
I imagine I'll need to split it up starting from the above ...
Concern:
Now, my concern is that without the common HTTP handler and extra route above i.e. once I have them as two separate projects, they will be two separate IIS sites/applications so they will run on two different ports. I'd still like BOTH to respond to port 80 as
http(s)://www.site.com -> web site project
http(s)://www.site.com/api -> web service
Assuming I'm successful in separating the website and the web service, how would I setup IIS for the above?
Upvotes: 1
Views: 1310
Reputation: 13722
I ended up setting the main website as the root / primary site in IIS and then added the service as a virtual sub directory within that.
Upvotes: 3