self-hosting

Specify a Singleton service in a WCF self hosted service

99封情书 提交于 2019-11-27 06:41:31
问题 I am writing an application that exposes a service via WCF. The service is self-hosted (console app) and needs to use a Singleton instance. I am trying to figure out how to specify singleton in the service configuration without using attributes on the service implementation. Is it possible to specify singleton in code without an attribute? Thanks, Erick 回答1: You can pass instance of the service to the ServiceHost constructor instead of passing a type. In such case your passed instance will be

WebApi with OWIN SelfHost and Windows Authentication

十年热恋 提交于 2019-11-27 05:53:25
问题 I have a console application SERVER that hosts WebApi controllers using OWIN self-hosting, and runs under a custom account named "ServiceTest1". In the same machine I have another console application CLIENT that runs under the account "ServiceTest2", and I want to capture in SERVER that "ServiceTest2" invoked a controller action. However: WindowsIdentity.GetCurrent() is always "ServiceTest1". Thread.CurrentPrincipal is an unauthenticated GenericIdentity . RequestContext.Principal is null.

Self hosted OWIN and urlacl

左心房为你撑大大i 提交于 2019-11-27 01:42:58
I've created a self hosted Nancy/SignalR application self-hosted in OWIN using Microsoft.Owin.Host.HttpListener and Microsoft.Owin.Hosting Things work perfectly fine locally but as soon as I try to use anything but localhost to access the app I get a HTTP Error 503. The service is unavailable error. I can't even access the app using 127.0.0.1 or the machine name. I've tried adding the port to urlacl using http add urlacl http://*:8989/ user=EVERYONE but doesn't seem to do anything. here are the OWIN start options that I've tried, var options = new StartOptions { Url = "127.0.0.1", App =

self hosting asp.net mvc

筅森魡賤 提交于 2019-11-26 21:59:10
Is it possible to self host asp.net mvc inside another application ie. console, windows forms, service etc etc. I'd like to build an app that offers a web interface to control it and I'd like to use asp.net mvc for the web part of it. I did take a quick look at Nancy which looks like it would work, though its not asp.net mvc it did support razor although it doesn't have quite the same level of support for it as asp.net (eg. strongly typed views) I did also find this question but it doesn't really go into much depth Possible to use ASPNET MVC2 without IIS? You can use "IIS 7.0 Hostable Web Core

How to get gzip compression working in WCF 4.5

谁说我不能喝 提交于 2019-11-26 20:23:50
问题 WCF 4.5 supports GZIP without third party libraries or handwritten extensions. I got it working via TCP Binding, but cannot find a way to get it working via HTTP Binding. my wcf - Service is self hosted in a windows service. Addon: i am not allowed to use IIS; i can't switch to any WCF replacement. this works with gzip: binding="customBinding" bindingConfiguration="tcpCompressionBinding" name="tcp" and this is what i currently use for http: binding="basicHttpBinding" bindingConfiguration=

Run WCF ServiceHost with multiple contracts

吃可爱长大的小学妹 提交于 2019-11-26 19:45:40
Running a ServiceHost with a single contract is working fine like this: servicehost = new ServiceHost(typeof(MyService1)); servicehost.AddServiceEndpoint(typeof(IMyService1), new NetTcpBinding(), "net.tcp://127.0.0.1:800/MyApp/MyService1"); servicehost.Open(); Now I'd like to add a second (3rd, 4th, ...) contract. My first guess would be to just add more endpoints like this: servicehost = new ServiceHost(typeof(MyService1)); servicehost.AddServiceEndpoint(typeof(IMyService1), new NetTcpBinding(), "net.tcp://127.0.0.1:800/MyApp/MyService1"); servicehost.AddServiceEndpoint(typeof(IMyService2),

Resolving HttpControllerContext with Castle Windsor

烈酒焚心 提交于 2019-11-26 16:23:15
问题 In the ASP.NET Web API, HttpControllerContext instances provide a lot of information about the current environment, including the URI of the current request. If a service relies on such information (e.g. the request URI), it should be possible to inject that information into the service. This is pretty easy to do using Poor Man's DI: just implement a custom IHttpControllerActivator. However, with Castle Windsor this suddenly becomes very difficult. Previously, I've described a very convoluted

HttpSelfHostServer and HttpContext.Current

荒凉一梦 提交于 2019-11-26 13:18:38
问题 I'm working on a self-hosted ASP.NET web api-application. Everything works fine, but now I'm struggling with HttpContext : I need to save session-informations from the client. But HttpContext.Current is always null. So it's obvious that my HttpSelfHostServer don't work with the static HttpContext-Class. The thing I don't understand is: why..? And I can't figure out a way to tell neither HtttpSelfHostServer nor HttpSelfHostConfiguration to work with HttpContext . Here's what I'm doing:

Run WCF ServiceHost with multiple contracts

依然范特西╮ 提交于 2019-11-26 08:59:33
问题 Running a ServiceHost with a single contract is working fine like this: servicehost = new ServiceHost(typeof(MyService1)); servicehost.AddServiceEndpoint(typeof(IMyService1), new NetTcpBinding(), \"net.tcp://127.0.0.1:800/MyApp/MyService1\"); servicehost.Open(); Now I\'d like to add a second (3rd, 4th, ...) contract. My first guess would be to just add more endpoints like this: servicehost = new ServiceHost(typeof(MyService1)); servicehost.AddServiceEndpoint(typeof(IMyService1), new

self hosting asp.net mvc

落爺英雄遲暮 提交于 2019-11-26 08:08:31
问题 Is it possible to self host asp.net mvc inside another application ie. console, windows forms, service etc etc. I\'d like to build an app that offers a web interface to control it and I\'d like to use asp.net mvc for the web part of it. I did take a quick look at Nancy which looks like it would work, though its not asp.net mvc it did support razor although it doesn\'t have quite the same level of support for it as asp.net (eg. strongly typed views) I did also find this question but it doesn\