self-hosting

WCF REST Self-Hosted 400 Bad Request

久未见 提交于 2019-12-06 16:02:25
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 System.ServiceModel.Web using System; using System.Diagnostics; using System.ServiceModel; using System

How to stop self-hosted WCF service upon unhandled errors?

若如初见. 提交于 2019-12-06 16:02:19
问题 I have a self-hosted WCF service that is running as a Windows Service. For the tests, I'm running it as a console application. I'd like to catch all unhandled exceptions that happen in the service and shutdown the host. I'd like to catch all non FaultExceptions that happen when producing a response, but also all exceptions that are thrown in "idle mode" - i.e. thrown from some worker threads. Unfortunatelly, I can't handle the exceptions neither by IErrorHandler (not called), nor by AppDomain

Hosting WebAPI in Windows-Service crashes on first attempt

為{幸葍}努か 提交于 2019-12-06 15:47:07
I have an console-app with hosted WebAPI (HttpSelfHostServer). In the console-app I have Controllers that query data from SQL-Server. The console-app works without problems (from fiddler and a Windows_client) Now I want to host the WebAPI (HttpSelfHostServer) in a Windows-Service. Therefore I have created a Service-Project and referenced the Controllers in console-app-dll so that the controllers should be found. To have a minimal chance to debug, I write some information in the event log from the windows service. I can start and stop the windows-service without problems. It also seems as that

servicestack self-hosted service uses chunked encoding - is unbuffered?

自闭症网瘾萝莉.ら 提交于 2019-12-06 09:07:57
I am trying to learn ServiceStack with the hello world examples and self-hosted example. I am making requests for JSON content. I have noticed the following in the response headers: Basic service hosted in an ASP.Net project: HTTP/1.1 200 OK Server: ASP.NET Development Server/10.0.0.0 Date: Wed, 10 Apr 2013 12:49:46 GMT X-AspNet-Version: 4.0.30319 X-Powered-By: ServiceStack/3.943 Win32NT/.NET Cache-Control: private Content-Type: application/json; charset=utf-8 Content-Length: 16 <------------------------------------- Connection: Close Same basic service, self-hosting (command line): HTTP/1.1

How to Deploy Owin Self Hosted Application In Production?

夙愿已清 提交于 2019-12-06 04:28:32
问题 I have an Asp.Net Owin Self Hosted WebApi application. The application can be installed as a windows service in production environment. Currently I'm running and accessing the service via url http://localhost:8000 successfully. Now I want to map the service to a domain to access it from public network. I have a registered domain and have control over it. Ex: www.myservice.com How can I point the domain to WebApi service for a Self Hosted Application? 回答1: In order to allow public access to

How do I enable the TypeScript tab of a Visual Studio project that's a console or windows service that's self-hosting web-pages

爱⌒轻易说出口 提交于 2019-12-05 23:07:33
Using Visual Studio 2015 I created a console application to self-host Owin with embedded static files. Since Visual Studio doesn't know it's a web-site project, it ignores TypeScript files. When I go to the project properties, the TypeScript tab's typically there in web projects is missing. How do I enabled the TypeScript tab so that I can configure TypeScript and use Visual Studio 2015's built-in capabilities to compile TypeScript. Open the .csproj file in a text editor and add the following line <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)

How to get Swagger Plugin working within self hosted servicestack

守給你的承諾、 提交于 2019-12-05 21:40:23
I've re-asked this question with examples provided on github and a drop box download link for anyone that want to run the code themselves : Swagger not working on a self hosted ServiceStack Service I had my servicestack JSON service running inside my website solution, under the '/api/ path, but now I'd like to split out that service stack portion and have it running as a self hosted windows service. My problem is, myself and the other developers find the Swagger plugin very useful for testing purposes, but now that it's self hosted it appears the HTTPHandler is setup only for only handling the

Remotely connect to .net core self hosted web api

穿精又带淫゛_ 提交于 2019-12-05 12:06:00
问题 I have a simple .net core web api with one action: [Route("[action]")] public class APIController : Controller { // GET api/values [HttpGet] public string Ping() { return DateTime.Now.ToString(); } } If I run this via dotnet run I get Hosting environment: Production Content root path: C:\Users\xxx\Documents\Visual Studio 2015\Projects\SelfHostTest\src\SelfHostTest Now listening on: http://localhost:5000 Application started. Press Ctrl+C to shut down. Going to the browser and typing in http:/

Reading WCF behavior elements from config file programmticlally when exposing self-hosted service

大兔子大兔子 提交于 2019-12-05 08:09:47
I have this configuration in my app.config: </binding> </basicHttpBinding> </bindings> <behaviors> <serviceBehaviors> <behavior name="myBehavior"> <serviceMetadata httpGetEnabled="true"/> <serviceDebug includeExceptionDetailInFaults="true"/> </behavior> </serviceBehaviors> </behaviors> I want to expose this service programmatically from my desktop app: I define the host instance: ServiceHost host = new ServiceHost(typeof(MyType), new Uri("http://" + hostName + ":" + port + "/MyName")); Then I add the endpoint with it's binding: var binding = new BasicHttpBinding("myBinding"); host

Owin self-host - Failed to listen on prefix 'http://localhost:12345/' because it conflicts with an existing registration on the machine

佐手、 提交于 2019-12-05 04:12:36
I'm trying to self-host a simple WebAPI: public class AccountViewApplication { protected IDisposable WebApplication; public void Start() { WebApplication = WebApp.Start<WebPipeline>("http://myhost.mymachine.me:12345"); new AccountViewApplication().Start(); } public void Stop() { WebApplication.Dispose(); } } The first time I run this, it starts to listen just fine, but the next time that I try - I get this: Failed to listen on prefix ' http://myhost.mymachine.me:12345/ ' because it conflicts with an existing registration on the machine What can I do to make it listen every time, and not