以下のコードを使用していますが、この行にエラーが表示されますappHost.Start(listeningOn)
。ServiceStackサービスの起動エラー
私はビンやOBJフォルダーを削除し、さらに再起動のVisual Studioが、エラーが解消されない:ここで
はコードです:
var listeningOn = $"http://*:{Globals.RestServicePort}/";
var appHost = new AppHost();
appHost.Init();
appHost.Start(listeningOn);
、これは誤りです:
The process cannot access the file because it is being used by another process
StackTrace:
at ServiceStack.WebHost.Endpoints.Support.HttpListenerBase.Start(String urlBase, WaitCallback listenCallback) at ServiceStack.WebHost.Endpoints.Support.HttpListenerBase.Start(String urlBase) at NotifierServer.WindowsService.NotificationService.Start() in E:\dev\projectname\WindowsService\mService.cs:line 23
APPHOSTクラス:
public class AppHost : AppHostHttpListenerBase
{
public AppHost()
: base("HttpListener Self-Host", typeof(NotifierRestService).Assembly)
{
////disable metadata
//SetConfig(new EndpointHostConfig
//{
// EnableFeatures = Feature.All.Remove(Feature.Metadata)
//});
}
public override void Configure(Funq.Container container)
{
container.Register<IResourceManager>(new ConfigurationResourceManager());
Plugins.Add(new AuthFeature(() => new AuthUserSession(),
new IAuthProvider[]
{
new BasicAuthProvider(), //Sign-in with HTTP Basic Auth
new CredentialsAuthProvider(), //HTML Form post of UserName/Password credentials
}));
Plugins.Add(new RegistrationFeature());
// use redis cache server
container.Register<IRedisClientsManager>(c => new PooledRedisClientManager("localhost:6379"));
container.Register(c => c.Resolve<IRedisClientsManager>().GetCacheClient());
// for authentication
var dbFactory = new OrmLiteConnectionFactory(Globals.ConnectionStringNotifier,
ServiceStack.OrmLite.PostgreSqlDialect.Provider);
var userRep = new OrmLiteAuthRepository(dbFactory);
container.Register<IUserAuthRepository>(userRep);
// create necessary auth tables
userRep.CreateMissingTables();
}
あなたは吊り下がっていなくていないプロセスがあるように思えます。タスクマネージャで見つけてください。システムを再起動してください。 – AlG
私はVisual Studioとサービスに関連するすべてのプロセスを削除しましたが、まだエラーがあります。マシンを再起動することは、サーバーマシンであるため、オプションではありません。 – Ali
それはVSに関連しないプロセスでなければなりません。 :) – AlG