en utilisant VS2015 avec des droits d'administrateur mon hôte démarre et je peux recevoir des demandes en utilisant Nancyfx.Owin Self Host ne démarre pas
IDisposable host = null;
IDisposable HostStart()
{
try
{
return WebApp.Start<Startup1>("http://*:7002");
}
catch (HttpListenerException ex)
{
throw new Exception(ex.Message);
}
}
Quand je fais un projet d'installation avec l'extension de Visual Studio et construire et installer puis exécutez avec admin privalages Je ne reçois aucune exception, mais le serveur ne peut pas être found.I avez désactivé le pare-feu. Je n'ai plus d'idées?
MISE À JOUR: Je reçois une exception
An exception has been thrown by the taget of invocation.
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Exception: Object reference not set to an instance of an object.
at CabbyTechOffice.Startup1.Configuration(IAppBuilder app)
--- 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, CultureInfo culture)
at Owin.Loader.DefaultLoader.<>c__DisplayClass12. <MakeDelegate>b__b(IAppBuilder builder)
at Owin.Loader.DefaultLoader.<>c__DisplayClass1. <LoadImplementation>b__0(IAppBuilder builder)
at Microsoft.Owin.Hosting.Engine.HostingEngine.ResolveApp(StartContext context)
at Microsoft.Owin.Hosting.Engine.HostingEngine.Start(StartContext context)
at Microsoft.Owin.Hosting.Starter.DirectHostingStarter.Start(StartOptions options)
at Microsoft.Owin.Hosting.Starter.HostingStarter.Start(StartOptions options)
at Microsoft.Owin.Hosting.WebApp.StartImplementation(IServiceProvider services, StartOptions options)
at Microsoft.Owin.Hosting.WebApp.Start(StartOptions options)
at Microsoft.Owin.Hosting.WebApp.Start[TStartup](StartOptions options)
at Microsoft.Owin.Hosting.WebApp.Start[TStartup](String url)
at CabbyTechOffice.MAIN.HostStart()
Il semble que l'arbitre est nulle au démarrage:
public class MyBoot : DefaultNancyBootstrapper
{
protected override void ConfigureApplicationContainer(TinyIoCContainer container)
{
CabbyTechOfficeConfig fig = ConfigUI.GetCabbyTechConfig();
if (fig == null)
{
throw new Exception("NO CONFIG");
}
ICabbytechOfficeDataAccess DB = null;
try
{
DB = ConnDBCreater.CreateDB(fig.DatabaseComputerName + "\\" + fig.DatabaseInstanceName, "taxidb", fig.DbPassword, 8);
IPEndPoint smsEP = null;
SmsCommsMob sms = null;
var comms = new ControlConnectAndSend(new IPEndPoint(IPAddress.Any, fig.DispatchFromPDAServerPort));
try
{
smsEP = new IPEndPoint(IPAddress.Parse(fig.SmsIp), fig.SmsPort);
sms = new SmsCommsMob(smsEP);
}
catch (Exception)
{
}
StateInjector stateInjector = new StateInjector(DB, comms, sms);
UdpBroadcasterJson.Send(new UDPCmd() { code = UDPCmd.commandsEnum.broadcastForDispatch }, stateInjector.UDPDispatchPort);
try
{
var comp = DB.CompaniesGet();
stateInjector.CompanyName = comp.company;
}
catch (Exception)
{
}
try
{
stateInjector.zones = DB.ZonesGet();
}
catch (Exception)
{
}
try
{
var locLog = new PdaLocLog();
var locLogger = new PdaLocLogger(DB, locLog);
stateInjector.locLogger = locLogger;
}
catch (Exception)
{
}
container.Register<IStateInjector, StateInjector>(stateInjector);
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
}
}
Vérifiez si le port n'est pas utilisé 'C: \> netstat -bano | findstr "7002" ' – vendettamit
J'ai vérifié merci aucun service sur ce port. Je dois mettre à jour la question en raison d'une exception qui s'est produite mais je n'avais pas réalisé. –
Pouvez-vous obtenir une exception interne? –