Reputation: 321
I am trying to create a restful service using service stack. How do I configure the end point of the service that I am trying to create? The default is 8080 and I want to be able to run multiple services at the same host.
Thanks
Upvotes: 1
Views: 2938
Reputation: 21511
This depends on how you use ServiceStack. ServiceStack can be included in an existing ASP.NET Web Application as an HttpModule or it can be configured to be a Self Hosted application.
As a self hosted application you would define the port your require to run your service on when specifying the HTTP listener configuration in the AppHost:
public static void Main()
{
// Very simple self hosted console host
var appHost = new AppHost();
appHost.Init();
appHost.Start("http://*:8080/"); // Update the port number here, change 8080
Console.ReadKey();
}
When running your ServiceStack application inside an ASP.NET Web Application (with or without MVC) on Windows you will use IIS (or Cassini/ IISExpress during development) on Mono platforms, such as Mac OS X, you will use fastcgi-server (or XSP during development). In which case you can configure your server port this way:
In development, you can configure the port in your project settings.
This step will depend on the version of Visual Studio you are using, but they are all similar.
You will then see options similar to these screenshots, depending on your version.
If you have IISExpress configured for development, change where it shows 51283, in the Project URL, in this screenshot to the port number you require.
If you have Cassini, the Visual Studio Development Server, for development Older versions of Visual Studio, change where it shows 63919 in this screenshot to the port number you require.
You will configure the port number in the hosting server configuration. For IIS please see here, for others you will need to refer to their documentation.
I hope this helps.
Upvotes: 2
Reputation: 5806
With a single configuration, you can create multiple services with same root url. Example is http://localhost:8080/api/customers
and http://localhost:8080/api/vendors
. root level end point in your application is configurable. For example instead of /api
you can use any path. refer to this wiki page from servicestack.
Upvotes: 0