How to host .Net Core service in IIS without service being recycled - wcf

I have a .Net Core Service with a WCF Relay Endpoint. This service needs to be up and running all the time. I do not want to host it as Windows Service, until I'm 100% sure, it is the only solution.
I tried to setup ApplicationPool with "StartMode=AlwaysRunning", "Idle Time-out (minutes)=20" and set Recycling to "Regular time interval(in minutes)=60" but it did not help. Maybe, it is only working for Asp.Net Apps with global.asax events: https://weblog.west-wind.com/posts/2013/oct/02/use-iis-application-initialization-for-keeping-aspnet-apps-alive
Any idea? Thank you.

Related

.NET 4.0 WebAPI on IIS6: Starts returning 404 until ApplicationPool restart

We have a .NET 4.0 ASP.NET WebForms website and mixed ASMX/WebAPI webservice deployed to a Windows Server 2003 IIS 6.0 instance that is suffering from 404s being retuned from the WebAPI controllers for various periods of time.
The WebAPI controllers are in the same project/site as the ASMX service, however, the ASMX service has no issues. Both the webservice and WebForms website are hosted in the same ApplicationPool, though are separate IIS sites.
A snippet of the IIS logs is below, where the WebAPI service seems to recover by itself :
When this error has occurred recycling the ApplicationPool has done the trick, though sometimes it appears that an ApplicationPool recycle actually starts the problem. It has happened once or twice immediately after a recycle after a new deployment. A second recycle fixes the issue. I have turned off periodic ApplicationPool recycling to see if this stops the issue.
I am not really sure where I should be looking from here...

Combining an HttpListener service and a Wcf service

I'm building a self-hosted service to be consumed by Silverlight. This service is not a straight Wcf service, but it uses HttpListener to implement a streaming service for Silverligt. To mkae it accessible by Silverlight, I've created another service (that is a Wcf service) to serve the clientaccesspolicy.xml file.
My problem is that once my clientaccesspolicy service is registered at http://localhost:9001 I cannot access my streaming service that is listening at http://localhost:9001/silverlightstream.
I've a couple of other Wcf services registered at http://localhost:9001/xxx which can seamlessly coexist with the clientaccesspolicy service.
What do I need to do to get the streaming service to work together with the clientaccesspolicy service?
Thanks in advance for your help.
I've answered a similar question before, I don't know how much it fits your situation, but it does look like it might help you out a little:
How can I host a Silverlight 4 application in a WPF 4 application?
In my project, I took it further and delivered the html/xap files via said self hosted service (so as not to require IIS, as IIS was a bit too much bloat for what I required).

Hosting of ajax enabled wcf service in IIS 7

I have deployed an asp.net mvc application in IIS, The application has been deployed successfully and working fine. I Used ajax enabled wcf service in my application, the problem is when I want to use the method of the service. I get the not found error, but when I browse to see the service it gives the page saying that your service is hosted, I cannot access the methods of the deployed ajax enabled service.. Kindly help me out..
Things to be noticed..
My services are hosted as a file with the extension of .svc
I deployed the application on windows server 2008 r2 64 bit, but I configured the application pool to work in 32 bit.
Services are accessible, but the methods of service are not allowed.
Thanks in advance.
Ahsan Nomani.

TCP WCF Service isn't executing Application_Start

Problem:
The Application_Start event is not being triggered in my WCF Service which contains a TCP endpoint.
Background:
I'm hitting trying to hit the service from a console app. If the service is not yet started, the call will fail because Application_Start never fires. However, if I explicitly start the service (hit the hosting web app from a browser) then and then call the service from the console app it works fine.
Question:
What gives? If the only thing being hosted in the service application is a tcp endpoint does Appliction_Start of the HttpApplication never get triggered? It makes sense to a certain degree as it is essentially being treated as a non-http application via WAS. However, it doesn't make sense because it is being hosted in IIS.
Application_Start will never be hit in a WAS hosted WCF service. This event is ASP.NET specific (no IIS specific), so unless you are hosting your WCF service in ASP.NET it won't be hit: and you are not as it is hosted by WAS.

How would you communicate a wcf service with a windows service?

Two weeks ago I needed a way to communicate a wcf service with a windows service running on the same computer. The windows service had to get data from a external source and share it with the wcf service (hosted in IIS) who had to give it when a client made a request. I chose to do that with ipc.
I done it and now the windows service is the ipc server and the wcf service is the ipc client. This goes well but I think I made a mistake doing this because to make it run right the windows service must to be executed with the ASPNET account, for this the ASPNET password account must be assigned and when I do that the IIS does not work correctly.
I am thinking on different alternatives, but in all of them the problem persists. Some ideas?
Edit:
What I needed was a system that made public, in a web service hosted in IIS, data gotten through telnet from another old system, what is a little unstable. How the response of this second system was slow I chose to put a process (the windows service) between the web service and the old system. The windows service had to save the data collected from the old system and when the wcf service asked it give it all at once through ipc.
Why does the windows service need to run as the ASPNET user? Is that because you're using an IPC connection that requires authentication from the caller?
Another alternative (if you have control over the windows-service code) would be to make that a WCF service as well (using a ServiceHost in the windows service). The IIS service could connect to the windows service using a NetTcp or NetNamedPipe binding if you need the IPC-like performance.
Why not just create another account with the same permission set of the ASPNET user which both the WCF service and your other service run under? That way, you have control over the password.
Ideally, the windows service should run as a WCF service, that way its easy for the client to communicate with it.
The next question is weather the 'client' needs to be a WCF service. If this client needs to serve other applications then it is appropriate, otherwise it may not be nessesary. I don't know enough about your system, so its up to you to decide what's best!