WCF Problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • blutner@googlemail.com

    #1

    WCF Problem

    Hello,

    I have got a little test application, which provides an WCF service
    and wants to consume it as well. The access does only succeed for the
    case, that the consumption is done by another application instance,
    but that's not really the thing I want. My question now is, if my
    problem is gernerally solveable, and if so, in which way I have to
    change my code.

    Thank you for your help!

    Robert


    -ITestService.vb

    Public Interface ITestService

    Function HelloWorld() As String

    End Interface


    -TestService.vb

    Public Class TestService
    Implements ITestService

    Public Function HelloWorld() As String Implements
    ITestService.He lloWorld
    Return "Hello World!"
    End Function

    End Class


    -FrmMain.vb

    Public Class FrmMain

    Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
    System.EventArg s) Handles Button1.Click
    ' Provide the service!
    Dim host As New ServiceModel.Se rviceHost(GetTy pe(TestService) )
    host.Open()
    MsgBox("Service started.")
    End Sub

    Private Sub Button2_Click(B yVal sender As System.Object, ByVal e As
    System.EventArg s) Handles Button2.Click
    ' Connect to the service!
    Dim address As New ServiceModel.En dpointAddress(" net.pipe://localhost/
    TestHost")
    Dim binding As New ServiceModel.Ne tNamedPipeBindi ng()

    Dim service As ITestService = ServiceModel.Ch annelFactory(Of
    ITestService).C reateChannel(bi nding, address)
    MessageBox.Show (service.HelloW orld())
    End Sub

    End Class

    --app.config

    At: http://clipboard.volectra.de/index.p...w&contentid=41

  • sloan

    #2
    Re: WCF Problem


    Dude,

    You need to read your posts, before submitting.

    What?? (are you asking?)

    I'm not trying to be a butt, just letting you know.

    Please post another message, this one is hard to read and understand.

    With that:

    2 things:
    I have a named piped example here:
    http://sholliday.space s.live.com/Blog/cns!A68482B9628 A842A!158.entry

    and there is a named pipe example at
    www.idesign.net in the downloads area.
    (This is a good site ... and i recommend juval lowy's book on WCF as well)

    ...

    If you're still stumped, please create another post.




    <blutner@google mail.comwrote in message
    news:1192822048 .028377.264520@ e9g2000prf.goog legroups.com...
    Hello,
    >
    I have got a little test application, which provides an WCF service
    and wants to consume it as well. The access does only succeed for the
    case, that the consumption is done by another application instance,
    but that's not really the thing I want. My question now is, if my
    problem is gernerally solveable, and if so, in which way I have to
    change my code.
    >
    Thank you for your help!
    >
    Robert
    >
    >
    -ITestService.vb
    >
    Public Interface ITestService
    >
    Function HelloWorld() As String
    >
    End Interface
    >
    >
    -TestService.vb
    >
    Public Class TestService
    Implements ITestService
    >
    Public Function HelloWorld() As String Implements
    ITestService.He lloWorld
    Return "Hello World!"
    End Function
    >
    End Class
    >
    >
    -FrmMain.vb
    >
    Public Class FrmMain
    >
    Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
    System.EventArg s) Handles Button1.Click
    ' Provide the service!
    Dim host As New ServiceModel.Se rviceHost(GetTy pe(TestService) )
    host.Open()
    MsgBox("Service started.")
    End Sub
    >
    Private Sub Button2_Click(B yVal sender As System.Object, ByVal e As
    System.EventArg s) Handles Button2.Click
    ' Connect to the service!
    Dim address As New ServiceModel.En dpointAddress(" net.pipe://localhost/
    TestHost")
    Dim binding As New ServiceModel.Ne tNamedPipeBindi ng()
    >
    Dim service As ITestService = ServiceModel.Ch annelFactory(Of
    ITestService).C reateChannel(bi nding, address)
    MessageBox.Show (service.HelloW orld())
    End Sub
    >
    End Class
    >
    --app.config
    >
    At: http://clipboard.volectra.de/index.p...w&contentid=41
    >

    Comment

    Working...