self-hosting

SignalR self hosted windows service, listening for messages

不问归期 提交于 2019-11-30 18:12:42
问题 I'm attempting to build a windows service that's self-hosting SignalR. I have read through tutorials such as SignalR Self-Host on ASP.Net I'm noticing that, least it seems, that they're based around broadcasting messages, and can't seem to find anything around listening. I need to listen to messages from within the service, as well as broadcast. We already have our backplane setup - it's the same one that the site uses. In a web site I can join a group, via Javascript. How do I join a group

Self-hosting WebAPI application referencing controller from different assembly

我与影子孤独终老i 提交于 2019-11-30 12:41:31
I came across this gem, which seemed to be close to what I wanted. However, I want to use the already-written controllers from a referenced assembly. My first crack was to reference the assembly, set up the routing rules the same as the original webAPI project and go, but I get 400s every time I try to call the self-hosted service. I've picked through the innards of the request with Fiddler, and aside from the address differences, the requests against the webAPI project and the self-hosted project are identical. I feel like this ought to be relatively straightforward, but I haven't found an

Web API self host - bind on all network interfaces

青春壹個敷衍的年華 提交于 2019-11-30 05:55:28
How do you make a Web API self host bind on all network interfaces? I have the below code currently. Unfortunately, it binds only on localhost. So access to this server from other than localhost is failing. var baseAddress = string.Format("http://localhost:9000/"); using (WebApp.Start<Startup> (baseAddress)) { Console.WriteLine("Server started"); Thread.Sleep(1000000); } Just change the base address like this var baseAddress = string.Format("http://*:9000/"); using (WebApp.Start<Startup> (baseAddress)) { Console.WriteLine("Server started"); Thread.Sleep(1000000); } And it should bind

How to set default static web page for Katana/Owin self hosted app?

一笑奈何 提交于 2019-11-30 04:53:26
I've set up a web site using an Owin self hosted console app. I'm serving static files with no problem, the 'root' of the static part of the site works properly, and the web API routes work fine also. If I browse to: http://localhost/index.html it presents everything like I expect. But I have not figured out how to set it so that browsing to: http://localhost presents index.html (as the default view). This Just Works under an IIS-style site. How do I make it work with Owin self host? I do it this way: var physicalFileSystem = new PhysicalFileSystem(webPath); var options = new FileServerOptions

Can WCF RIA Services be self hosted?

浪子不回头ぞ 提交于 2019-11-29 14:49:44
I know WCF can be self hosted. how about WCF RIA Services? Thanks! Alexey F Actually, it can be self-hosted after small configuration: DomainServiceHost host = new DomainServiceHost(typeof(DomainService1), uri); host.Description.Behaviors.Remove<AspNetCompatibilityRequirementsAttribute>(); WCF RIA Services is build on top of WCF and they get exposed as WCF services. See WCF RIA Services on MSDN . According to this forum thread on MSDN , it is not possible to do such thing because RIA services set the ASP.NET compatibility to be required, therefore needing the IIS hosting. 来源: https:/

WCF Self Host Service - Endpoints in C#

给你一囗甜甜゛ 提交于 2019-11-29 07:05:46
My first few attempts at creating a self hosted service. Trying to make something up which will accept a query string and return some text but have have a few issues: All the documentation talks about endpoints being created automatically for each base address if they are not found in a config file. This doesn't seem to be the case for me, I get the "Service has zero application endpoints..." exception. Manually specifying a base endpoint as below seems to resolve this: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.ServiceModel; using System

Web API self host - bind on all network interfaces

╄→尐↘猪︶ㄣ 提交于 2019-11-29 05:16:03
问题 How do you make a Web API self host bind on all network interfaces? I have the below code currently. Unfortunately, it binds only on localhost. So access to this server from other than localhost is failing. var baseAddress = string.Format("http://localhost:9000/"); using (WebApp.Start<Startup> (baseAddress)) { Console.WriteLine("Server started"); Thread.Sleep(1000000); } 回答1: Just change the base address like this var baseAddress = "http://*:9000/"; using (WebApp.Start<Startup> (baseAddress))

WCF self-hosted WebSocket Service with Javascript client

安稳与你 提交于 2019-11-28 19:20:05
问题 I have this WCF self-hosted WebSocket service code: Main: //Create a URI to serve as the base address Uri httpUrl = new Uri("http://192.168.1.95:8080/service"); //Create ServiceHost ServiceHost host = new ServiceHost(typeof(WebSocketService), httpUrl); //Add a service endpoint host.AddServiceEndpoint(typeof(IWebSocket), new NetHttpBinding(), ""); //Enable metadata exchange ServiceMetadataBehavior smb = new ServiceMetadataBehavior(); smb.HttpGetEnabled = true; host.Description.Behaviors.Add

Self-host of ASP.NET MVC application

时间秒杀一切 提交于 2019-11-28 17:56:31
I have a full-working ASP.NET MVC application (consisting of 5 assemblies, .NET 4.5.1, ASP.NET MVC 5.2.2) which runs fine in Visual Studio (which uses IISExpress). I would now like to have a console application which takes the MVC application and hosts it (self hosting). I tried with Microsoft.Owin.Host.HttpListener and Nancy.Owin but while I get 404 pages my configurations lacks the mapping to my MVC-app. I got public class Startup { public void Configuration(IAppBuilder app) { app.UseNancy(); } } and static void Main(string[] args) { StartOptions so = new StartOptions("http://localhost:9000/

Specify a Singleton service in a WCF self hosted service

試著忘記壹切 提交于 2019-11-28 12:01:19
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 You can pass instance of the service to the ServiceHost constructor instead of passing a type. In such case your passed instance will be used as singleton. Edit: My former solution doesn't work. Providing instance to ServiceHost constructor