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.
Self Hosted
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();
}
ASP.NET Web Application
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:
Development:
In development, you can configure the port in your project settings.
Visual Studio:
This step will depend on the version of Visual Studio you are using, but they are all similar.
- In the Solution Explorer right-click on your project
- Then choose Properties
- Then select the Web tab
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.
Xamarin Studio/ MonoDevelop
- In the Solution Explorer right-click on your project
- Then choose Options
- Then select the XSP Web Server tab, under the Run section
- Update the Port Number field
Production:
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.