self-hosting

WCF local only NamedPipe

戏子无情 提交于 2020-01-03 15:26:14
问题 Here's a simple example of my problem. I'm writing an application that self hosts a WCF service for communication only within the user's session. When multiple users run this application concurrently on a terminal services machine, all the users are happy as long as they don't have local admin rights. The problem begins if two or more users are admins, the 1st user creates the service, a 2nd user because the service has been created Globally... Simple Win32 implementation, without WCF, would

WCF REST Self-Hosted 400 Bad Request

会有一股神秘感。 提交于 2020-01-03 03:39:04
问题 I'm having a problem with a self-host WCF REST service. When I try to issue a GET via browser or Fiddler, I get a 400 Bad Request. Tracing is reporting an inner exception of XmlException "The body of the message cannot be read because it is empty." I don't have any configuration in app.config (do I need any?). I have tried changing WebServiceHost to ServiceHost, and WSDL is returned, but the operations still return 400. What am I missing here? // Add Reference to System.ServiceModel and

Self Hosted WCF Rest service ERROR : Type 'Newtonsoft.Json.Linq.JToken' is a recursive collection data contract which is not supported

被刻印的时光 ゝ 提交于 2020-01-02 08:24:11
问题 I have a WCF Rest service that's self hosted. It works fine until I decided I have to use JToken (Newtonsoft.Json.Linq.JToken). I then got the error : Type 'Newtonsoft.Json.Linq.JToken' is a recursive collection data contract which is not supported. Consider modifying the definition of collection 'Newtonsoft.Json.Linq.JToken' to remove references to itself. I've seen all the answers from this post, this one and others. The fact is, I'm hosting my services within an internal program (in the

ServiceStack Selfhosted Application Restart

对着背影说爱祢 提交于 2020-01-01 13:29:36
问题 How can I restart a ServiceStack self hosted Apphost? Setting my AppHost instance to null and disposing of it does not work correctly, it throws the following Exception: System.ArgumentException: An entry with the same key already exists. I need to be able to do this to reload settings and start the AppHost without restarting the Windows Service hosting the AppHost EDIT: Scott and Moo-Juice's suggestions to run the AppHost in a different AppDomain is the correct solution. In order to get past

Self-hosting WebAPI application referencing controller from different assembly

你说的曾经没有我的故事 提交于 2019-12-30 04:03:10
问题 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

Self-hosted WCF Data service authentication

时光怂恿深爱的人放手 提交于 2019-12-25 07:26:46
问题 I have self-hosted WCF Data service set up in similar way to this - http://blogs.msdn.com/b/writingdata_services/archive/2011/01/24/self-hosting-a-wcf-data-service.aspx How does one add Windows authentication on top of this? I know how to add it in IIS however self-hosted scenario is escaping me... Thanks in advance! 回答1: The trick is to use app.config and configure all the security settings there...: <?xml version="1.0" encoding="utf-8"?> <configuration> <system.serviceModel> <bindings>

Self-hosted WCF: automatically create service hosts and enable dependency injection with Autofac

十年热恋 提交于 2019-12-25 05:32:41
问题 I'm working on a Windows Service with a number of self-hosted WCF services. I'm using Autofac for DI/IoC. WCF services and endpoints are set up in app.config, and by enumerating the configured services, the Windows service is able to automatically create and open a ServiceHost for each configured WCF service. To enable dependency injection, I add a call to the AddDependencyInjectionBehavior (docs) method for each new instance of ServiceHost , but the method specifically requests a

ASP.Net self-hosted application

二次信任 提交于 2019-12-25 05:32:37
问题 How to control ASP.Net 5 application from console application? All examples of self-hosted application I've found assume that the lifetime of the webserver matches the lifetime of application. Is it possible to have assembly of ASP.Net 5 application with Startup.cs file and main assembly (console app) which allows to start and stop web application using this Startup class when I need? For example, Node.js allows to initiate new server at any place in code, like this http.createServer(function

How to throw FaultException from self hosting wcf service?

泪湿孤枕 提交于 2019-12-25 03:19:23
问题 I'm planning to host the service in windows service, but I'm thinking about the problem described in the title. Anyone had similar issue? Thanks Update The problem is that when you throw an exception in WinForms/WPF/Win Service app, the program crashes and you'll have to restart it. 回答1: An exception does not always crash your server. Even an unexpected server-side exception will be transferred to the client. It is considered more severe than an expected one though, faulting the channel. The

Synchronization problems with Monitor class in WCF service

僤鯓⒐⒋嵵緔 提交于 2019-12-24 05:39:22
问题 I have a self-hosted WCF service and I'm having the following problem: 15 minutes after creating the instance of the service TryEnter calls in operation contract methods constantly return false, but the TryEnter calls in Main function, which also uses synchronization via Monitor class, return true. Here's the description of my app and the bug: I am developing a self-hosted WCF service in Visual Studio 2008 (C#) in Windows XP SP2. The ServiceHost instance of the host is created at the