2016-03-25 9 views
0

Barındırma Stop yapamaz Ancak bu ben olsun incelikle hizmetin durdurulması için yeterli değil görünüyor aşağıdaki istisna:Ben <code>this.webApp.Dispose();</code></p> <p>diyoruz stop sırasında, Windows Hizmet ben bir windows hizmetinde barındırılan bir öz olarak web API 2 çalıştırıyorum Web API

Failed to stop service. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Net.HttpListenerException: Failed to listen on prefix 'http://+:8080/' because it conflicts with an existing registration on the machine. 
    at System.Net.HttpListener.AddAllPrefixes() 
    at System.Net.HttpListener.Start() 
    at Microsoft.Owin.Host.HttpListener.OwinHttpListener.Start(HttpListener listener, Func`2 appFunc, IList`1 addresses, IDictionary`2 capabilities, Func`2 loggerFactory) 
    at Microsoft.Owin.Host.HttpListener.OwinServerFactory.Create(Func`2 app, IDictionary`2 properties) 
    --- End of inner exception stack trace --- 
    at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) 
    at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) 
    at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, Cu... 

Yani hizmetini durdurmak için tek yol bu hizmet için PID almak ve öldürmek-sürecini kullanmaktır.

Durmaksızın uzun bir görev yürütmeyeceğimi bilerek hizmeti incelikle durdurmanın bir yolu var mı?

cevap

0

stop() windows hizmeti sırasında aslında bunu durdurma yerine web api'yi başlatan OnStart olayını arıyordum.

İlgili konular