Solved

ASP.NET-to-WinService communication?

Posted on 2006-06-29
4
241 Views
Last Modified: 2010-05-18
I have a Windows Service (myZOOMservice) running on ServerOMEGA (like a daemon). I have an IIS ASP.NET application running on ServerALPHA. From inside ASPX form code, how do I send an "OkDoItNow!" message to myZOOMservice? The ASPX does not pass data to myZOOMservice, nor does the ASPX need data returned from myZOOMservice. The communication is one-direction - from ServerALPHA.ASPX to ServerOMEGA.myZOOMservice - and it simply triggers a predefined action in myZOOMservice.

I don't even know where to start reading or looking.
0
Comment
Question by:volking
  • 2
  • 2
4 Comments
 
LVL 23

Expert Comment

by:Jens Fiederer
ID: 17010495
This depends very heavily on myZOOMservice.

Does it already accept messages, and, if not, can you change myZOOMservice?
0
 
LVL 5

Author Comment

by:volking
ID: 17011332
Yes, I wrote myZOOMservice using Visual Studio, a Windows Service project, and C#.
I can make myZOOMservice do anything. At least anything you can help me do (smile)

0
 
LVL 23

Accepted Solution

by:
Jens Fiederer earned 500 total points
ID: 17011819
One approach is to use Remoting.

In the service (I was using VB, but C# is almost identical if you add a few semicolons:)
Also provide the MyFunction to do what is needed:

     Public Shared Sub Main()
        m_sAppServerPort = 9988 ' port number

        Dim provider As New BinaryServerFormatterSinkProvider
        provider.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full
        Dim props As IDictionary = New Hashtable
        props("port") = m_sAppServerPort
        m_objChannel = New TcpChannel(props, Nothing, provider)
        ChannelServices.RegisterChannel(m_objChannel)
        Remotable.Remoting.RegisterSingleCall(GetType(Myfunction), "App/Function")
    End Sub

In the client:
        Dim provider As New BinaryServerFormatterSinkProvider
        provider.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full
        Dim props As IDictionary = New Hashtable
        props("port") = 0
        m_objChannel = New TcpChannel(props, Nothing, provider)
        ChannelServices.RegisterChannel(m_objChannel)
        RemotingConfiguration.RegisterWellKnownServiceType(GetType(MyFunction), YourURL, WellKnownObjectMode.SingleCall)

and then you can just call MyFunction in your code to get things started.



0
 
LVL 5

Author Comment

by:volking
ID: 17013334
Cool ... I will try it ... later
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Check number of row prior to displaying gridview 10 72
Save ms data to server side. 19 58
exporting html table data 4 37
How to filter by key press ? 6 53
Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question