Solved

ASP.NET-to-WinService communication?

Posted on 2006-06-29
4
240 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

808 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