Click here to Skip to main content
15,904,652 members
Home / Discussions / C#
   

C#

 
AnswerRe: Not Getting Proper Output From Compiled EXE File Pin
Wendelius18-Sep-15 20:15
mentorWendelius18-Sep-15 20:15 
General[CAUSE]: Not Getting Proper Output From Compiled EXE File Pin
Bastar Media18-Sep-15 20:52
Bastar Media18-Sep-15 20:52 
GeneralRe: [CAUSE]: Not Getting Proper Output From Compiled EXE File Pin
Wendelius18-Sep-15 21:31
mentorWendelius18-Sep-15 21:31 
GeneralRe: [CAUSE]: Not Getting Proper Output From Compiled EXE File Pin
Bastar Media18-Sep-15 21:41
Bastar Media18-Sep-15 21:41 
General[SOLVED]: Not Getting Proper Output From Compiled EXE File Pin
Bastar Media18-Sep-15 21:38
Bastar Media18-Sep-15 21:38 
GeneralRe: [SOLVED]: Not Getting Proper Output From Compiled EXE File Pin
Wendelius18-Sep-15 21:42
mentorWendelius18-Sep-15 21:42 
GeneralRe: [SOLVED]: Not Getting Proper Output From Compiled EXE File Pin
Bastar Media18-Sep-15 21:47
Bastar Media18-Sep-15 21:47 
QuestionNancyFx in OWIN and Windows Service host Pin
LIttle_Cat17-Sep-15 20:25
LIttle_Cat17-Sep-15 20:25 
Hello. Please help me to solve a problem.
I use NancyFx and for code optimisation i decided to use only OWIN SelfHost
without usage NancyFx SelfHost.
I create windows service where i place code (OnStart function)
C#
 _s7Comm = _container.Resolve<IS7Comm>(); // s7 controller class connection
 _context = Rhs60Hub.HubContext;          // hub context

 // events for send info to hub from s7
 _s7Comm.OnErrorEvent += S7CommOnErrorEvent;
......

 var startup = _container.Resolve<Startup>(); // use Unity IoC

 Service = WebApp.Start("http://+:8081/", startup.Configuration);


Start service with a help of Windows Service Helper - everythin is working.
Do service stop, code (OnStop function)

C#
_s7Comm.OnErrorEvent -= S7CommOnErrorEvent;
.....

_s7Comm.Dispose(); // free all tasks in object

Service.Dispose(); // stop nancy

start again - branch with initialise NancyFX does not start but gives exception NullReferenceException.
my Start Class for Owin

C#
app.UseCors(CorsOptions.AllowAll);
app.MapSignalR("/signalr", new HubConfiguration() { EnableDetailedErrors = true, EnableJSONP = true, EnableJavaScriptProxies = true });
app.UseNancy(options => options.Bootstrapper = new Bootstrapper(UnityHelper.GetConfiguredContainer())); <- error here


For test I determine start of NancyFX with a help of package NancyFx SelfHost - all is good, start, stop and restar.

(OnStart function)
C#
        _s7Comm = _container.Resolve<IS7Comm>(); // s7 controller class connection
        _context = Rhs60Hub.HubContext;          // hub context

        // events for send info to hub from s7
        _s7Comm.OnErrorEvent += S7CommOnErrorEvent;
       ......

_host = new NancyHost(new Uri("http://localhost:8082"), new Bootstrapper(_container));

        _host.Start();

        var startup = _container.Resolve<Startup>(); // use Unity IoC

        Service = WebApp.Start("http://+:8081/", startup.Configuration);
and remove string from Start class with definitions for nancyFx

Where can be a problem with usage host in OWIN?
Code debuf shows that container is initialised and all dependencies are present.
How I can discover with dependence is not present? Show you stack tracing

C#
в Microsoft.Practices.Unity.UnityDefaultBehaviorExtension.SetLifetimeManager(
        Type lifetimeType, String name, LifetimeManager lifetimeManager)\r\n   
        в Microsoft.Practices.Unity.UnityDefaultBehaviorExtension.OnRegisterInstance
        (Object sender, RegisterInstanceEventArgs e)\r\n   
        в System.EventHandler`1.Invoke(Object sender, TEventArgs e)\r\n   
        в Microsoft.Practices.Unity.UnityContainer.RegisterInstance
        (Type t, String name, Object instance, LifetimeManager lifetime)\r\n   
        в Microsoft.Practices.Unity.UnityContainerExtensions.RegisterInstance[TInterface](IUnityContainer container, TInterface instance, LifetimeManager lifetimeManager)\r\n   
        в Nancy.Bootstrappers.Unity.UnityNancyBootstrapper.RegisterBootstrapperTypes(IUnityContainer applicationContainer)\r\n   
        в Nancy.Bootstrapper.NancyBootstrapperBase`1.Initialise()\r\n   
        в Nancy.Owin.NancyMiddleware.UseNancy(NancyOptions options)\r\n   
        в Owin.AppBuilderExtensions.UseNancy(IAppBuilder builder, NancyOptions options)\r\n   
        в Owin.AppBuilderExtensions.UseNancy(IAppBuilder builder, Action`1 configuration)\r\n   
        в RHS60SystemService.Startup.Configuration(IAppBuilder app)
        в c:\\......\\Startup.cs:строка 16"    string


string 16 is
C#
app.UseNancy(options => options.Bootstrapper = new Bootstrapper(UnityHelper.GetConfiguredContainer()));

AnswerRe: NancyFx in OWIN and Windows Service host Pin
Richard Andrew x6418-Sep-15 18:00
professionalRichard Andrew x6418-Sep-15 18:00 
QuestionREST Web API Query JSON Deserialization Pin
FMG Tech17-Sep-15 17:10
FMG Tech17-Sep-15 17:10 
AnswerRe: REST Web API Query JSON Deserialization Pin
Richard MacCutchan17-Sep-15 23:30
mveRichard MacCutchan17-Sep-15 23:30 
GeneralRe: REST Web API Query JSON Deserialization Pin
FMG Tech18-Sep-15 6:34
FMG Tech18-Sep-15 6:34 
GeneralRe: REST Web API Query JSON Deserialization Pin
Richard MacCutchan18-Sep-15 6:49
mveRichard MacCutchan18-Sep-15 6:49 
GeneralRe: REST Web API Query JSON Deserialization Pin
FMG Tech18-Sep-15 15:16
FMG Tech18-Sep-15 15:16 
QuestionEdit SVG text elements of XHTML page with C# Pin
Bartosz Jarmuż17-Sep-15 4:16
Bartosz Jarmuż17-Sep-15 4:16 
Questionc# RSA security Pin
Member 1198796116-Sep-15 20:11
Member 1198796116-Sep-15 20:11 
AnswerRe: c# RSA security Pin
Eddy Vluggen16-Sep-15 22:54
professionalEddy Vluggen16-Sep-15 22:54 
QuestionIn visual studio do you know what the name of this control ? Pin
Member 245846716-Sep-15 16:29
Member 245846716-Sep-15 16:29 
AnswerRe: In visual studio do you know what the name of this control ? Pin
Richard MacCutchan16-Sep-15 21:43
mveRichard MacCutchan16-Sep-15 21:43 
AnswerRe: In visual studio do you know what the name of this control ? Pin
Eddy Vluggen16-Sep-15 22:50
professionalEddy Vluggen16-Sep-15 22:50 
AnswerRe: In visual studio do you know what the name of this control ? Pin
BillWoodruff17-Sep-15 0:11
professionalBillWoodruff17-Sep-15 0:11 
GeneralRe: In visual studio do you know what the name of this control ? Pin
Member 245846717-Sep-15 23:26
Member 245846717-Sep-15 23:26 
AnswerRe: In visual studio do you know what the name of this control ? Pin
ngoj17-Sep-15 2:43
ngoj17-Sep-15 2:43 
GeneralRe: In visual studio do you know what the name of this control ? Pin
Pete O'Hanlon17-Sep-15 2:55
mvePete O'Hanlon17-Sep-15 2:55 
GeneralRe: In visual studio do you know what the name of this control ? Pin
ngoj17-Sep-15 3:14
ngoj17-Sep-15 3:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.