Solved

ASP.NET-to-WinService communication?

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

760 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now