How to run a WCFservice automatically on windows startup - wcf

I have an developed a mobile application which makes use of the WCFservices..
DETAILS OF MY APP AND WCF-SERVICE :
My app has an hierarchial workflow..it has various levels of users..requests and queries are raised from users which travels up the hierarchy for approval..Here my WCFService serves the purpose of fetching,filling and saving the requests and queries from and to the database server.
NOW HERE IS MY ACTUAL NEED :
The WCFService must start automatically on the system boot up, so that my app starts to get notifications if there are any new requests or queries for approval.
So how do i make my service to run automaticaly when the system starts up ??? can u pls guide me through the steps ??

Any service posted on IIS will start automatically because on windows startup the IIs loads automatically

You should host it using windows service. Here is one example of a link that could help you.

Related

Blazor Wasm - Publish 'lifecycle'

I have an active Blazor Wasm - Core Hosted site that is being used by one entity at the moment. Whenever I perform an update I wait until they're not using it (perhaps for no good reason).
Going forward, I'd hope to have multiple users and there will not be a common window where the site is not in use. Am sure this is not a unique requirement, so am pretty sure that its all covered under the hood, but if you can answer the following it would help clarify for me.
When a client connects to server the application is downloaded to client ...
Is this done by the script "_framework/blazor.webassembly.js"?
If I publish an update to my site at my hosting site whilst the application is in use ...
Am I right to assume that the application pool running in memory will
persist until I force a 'recycle'?
Does this mean that my published code will have no effect until the
pool is recycled? Or do new connections get the new app?
If I force a recycle whilst there are active users, might I not end up
with a downloaded client app that is out of sync with the running
server app?

Silverlight Login page work on machine but not on other machine (window 7)

I face some strange issue in Silverlight 5 on machine which use window 7.
I have a Silverlight app and after deploying it, it works fine on all user machine but on some of user machine it does not working.
For Example My Username : Test and password is Test.
Now when I use this info to login my app on my machine and also some of other machine then it works fine but when I use same info on other machine (Window 7) it does not work.
I have set mesg for invalid login info in wcf service and return mesg to user. I found that when I use invalid logininfo then it display mesg which I set in wcf method.
I also uninstall old Silverlight and install new on window 7 machine but then also not working.
I think there are something which block to response of wcf service. I am stuck into this issue.
Thanks,
Hitesh
I ran into the similar issue once
When you are talking about the WCF service not working on some machines,
the first thing I would check is the time on that machine(some users set their own time, which is different from the standard time in that particular time zone, WCF service just does not accept the requests from these machines) and then the security level of the WCF service and on the User machine.
Hope this info helps..

Hosting a continuosly running Console application

Azure VM, Cloud service or Web job?
I have a configurable console application which runs continuosly. Currently it is running on a VM and consumes lot of memory (it is basically doing data mining).
The current requirement is to have multiple instances of this application with different set of configuration which can be changed by specific users.
So where should I host this application such that the configuration can be modified using some front end which provides access managements(like Sharepoint),ability to stop it/restart (like WCF service) without logging on the VM?
I am open to any suggestions/ideas. Thanks
I don't think there's any sold answer to this question as there is the preference variable but for what it's worth, if it were up to me I would deploy it against individual azure VM's for each specific set of users. That way if the server resources went up because of config changes the user group made it is isolated to that group, and with azure, will scale automatically to meet the resource demand. Then just build a little .net web app to allow user to authenticate and change configuration settings.
You could expose an "admin" endpoint for your service (obviously you need authentication here!) that:
1. can return the current configuration
2. accept new configuration
3. restart the service (if needed). Stopping the service will be harder, since that leaves the question on how to start it again.
Then you need to write your own (or use a 3-party (like sharepoint or a CMS)) application that will handle your users and under the hood consume your "admin" endpoint.
Edit: The hosting part: If I understand you correctly your app is just an console application today, and you don't know how to host it? Well, there are many answers to that question. If you have a operations department go talk to them, if you are on your own play around and see what fits you and your environment best!
My tip: go for a http/https protocol/interface - just because there are many web host out there, and you can easy find tools for that protocol. if you are on the .NET platform check out Web.API or OWASP
Azure now has Machine learning to process data mining.
You should check if it's suit to you.
Otherwise, you can use Webjob:
Allow you to have multiple instances of your long time running job (Webjon scaling out).
AppSettings can be change from the Azure Portal or using the Azure Management API

WCF security problems with named pipes

I have a slightly complicated setup that, of course, works fine in XP, but chokes on Windows 7. It may seem like madness, but it made sense at the time!
I have a WPF application that launches and then launches another application that communicates with an external device. After launching it establishes communications with the new process using WCF (hosted by the new process) via a named pipe (net.pipe). This seems to work fine on either OS.
I wanted to make some of the functionality of the WPF application externally available to a command line program, so I set up another WCF service, this time hosted by the WPF application and again exposed it via named pipes. Again, this seems to work.
Next, I wanted to make the functionality of the WPF application available via the web. Now, it's important that the WPF application be runnable from a regular user account, so I thought the best way to make this work on Windows 7 would be to create a windows service that would provide the web service part and have it communicate back to the WPF application via the same named pipe that works fine for the command line. I implemented this and it runs fine on XP, but it chokes on Windows 7. The problem seems to be with trying to establish the named pipe connection between the windows service and the WPF application.
If I run the WPF app as an administrator, it works fine. So it seems to be a problem with the account that the windows service is running in can't communicate with a regular user account that is hosting the WCF service via named pipes. Is there a way to make this work? It seems a WCF service running in a regular user account can communicate using named pipes to another app running in the same account, but it seems it can't do the same thing with a different account.
Oddly, the reverse seems to work. The windows service does, in fact, also expose a service with a named pipe binding (it's used as an activation function since the service is running all the time). I can connect from the WPF app to this service without any problems.
My knowledge of security is somewhat limited. Can anybody shine a light on what's going on?
This question has been asked several times previously on SO. For example, see Connecting via named pipe from windows service to desktop app
The problem is that your user session applications don't possess the SeCreateGlobalPrivilege security privilege necessary to allow them to create objects in the global kernel namespace visible to other sessions, but only in the local namespace which is only visible within the session. Services, on the other hand, which run with this privilege by default, can do so.
It is not the named pipe object itself which is constrained to the local namespace in this way, but another named kernel object, a shared memory section, on which the WCF named pipe binding relies in order to publish to its clients the actual name of the pipe, which is a GUID which changes each time the service is started.
You can get round this constraint by reversing the roles - make the windows service application the WCF Service, to which your user session apps connect. The windows service has no problem publishing its service to your session. And connecting things up this way round makes more sense because the windows service is always running, whereas your session and its apps comes and goes as you log in and out. You'll want to define the service with a duplex contract, so that once the connection is established, the essential flow of communication over the WCF service can still happen in the same direction you originally intended.
The applications (WPF/Console) are creating locally scoped named pipes (this happens by default when they are unable to create globally scoped pipes). My guess is that they can communicate with each other because they can see each others named pipes because they are running under the same account.
The windows service has higher privileges and can therefore create a globally scoped named pipe for the client applications to see.
You can check out a discussion on Christian Weyer's Blog.

How to develop a WCF Service to automatically manage other related WCF services hosted as Window Service?

Kindly help me in architecting a solution which is required for my ongoing project.
I have developed some WCF Services hosted as windows services which I did and working fine so far. Now I am asked to develop a master WCF type of service which should be intelligent enough to manage all other WCF service for possible corruption/errors and can repair them and restart.
Thanks in advance.
As we have written a custom host and took us years to make it a real application server, I will share some of the challenges that we had. Creating a custom host that manages WCF services as an NT service is a very challenging task if you want to manage all of the details and treat the NT service as a real service host. The challenges start from managing multiple Appdomains ( one for each Service ), managing the statuses of the services, startup times, deployments from the IDE and the worst of all is activation. Have you considered how to implement that? If you do not have this feature, it means that all of your services will be active and in memory at all times. IIS and Appfabric do that very well and trust me , it is noty easy to implement. The other part that was challenging was a UI to manage this host and offcourse a UI that can manage multiple hosts ( NT services running on different boxes ). Do you need a discovery proxy implementation? And at last how about if you want to manage services running in your custom host , IIS and App fabric the same way?
Think about before doing such an implementation because the scope may crypt on you as you do it.
I do something similar here.
Create a Dictionary<key, ApplicationDomain> collection into your main program
Key: something unique for each application domain, like a Guid or a System.Type.
That ApplicationDomain class exposes a internal property to access your AppDomain proxy (that which inherits a MarshallByRef class)
Load your WCF host into main program, so you'll get access to that collection
Every time your service get some access, you just need to take that key, access your proxy and do anything you want within your service hoster.
Keypoint: Your service must have access to all your service hosts.