Quantcast
Channel: VBForums - WPF, WCF, WF
Viewing all articles
Browse latest Browse all 256

Wcf hello world

$
0
0
I am trying to get started with WCF. I want to create a hello world web service that runs on ASP.NET development server. I am stuck trying to get the web server to read the service. When I open the website's directory listing in my browser and click on the "HelloWorldService.svc" file, I get the server error:

The type 'MyHelloWorldService.HelloWorldService', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.

I have:

- created my service
- added a website to my project and added a reference to the service
- created a "HelloWorldService.svc" file with the following directive:

<%@ServiceHost Service="MyHelloWorldService.HelloWorldService"%>

This is how my service code files look:

Code:

Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text

Namespace MyHelloWorldService

    Public Class HelloWorldService
        Implements IHelloWorldService

        Public Sub New()
        End Sub

        Public Function GetData(ByVal value As Integer) As String Implements IHelloWorldService.GetData
            Return String.Format("You entered: {0}", value)
        End Function

    End Class

End Namespace

Code:

Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.ServiceModel

Namespace MyHelloWorldService

  <ServiceContract()>
    Public Interface IHelloWorldService

        <OperationContract()>
        Function GetData(ByVal value As Integer) As String

        End Interface

End Namespace


Viewing all articles
Browse latest Browse all 256

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>