How to configure WCF service with Silverlight support?

EDIT . I started a closed ballot on this issue because I solved this problem. I did everything well, but the link to the ASP URL converter, which I downloaded and deleted some time ago, still had the link in IIS. This forum post by Waclaw Stypula (the one with the steps) helped me track this by accident. When I ran the run command, IIS told me that it (obviously) could not find a rewritable DLL. I deleted the link and the application stopped after that.


I follow the silverlight.net lessons of Jesse Liberty . I'm currently trying to make tutorial three , but I'm running into the wall under the heading " CREATE A WEB SERVICE " (about halfway down).

First, when I create a new service by adding it to the solution, the tutorial indicates that three files should be created; IService1.vb, Service1.svcand Service1.svc.vb. I do not receive the file IService1.vbwhen I add the service to the solution. I downloaded the copy of the project they provided and the file Service1.svc.vbis there, so I added one manually and copied the contents of the file. The tutorial says this is a VB tutorial, but displays C # in the accompanying screenshot, so maybe this is a problem.

After I get all the files compiled as tutorials (copy / paste to make sure I don't have a typo), I try to add a link to the service and get the following error:

The service class of type KeyboardControl_Web.Service1 both defines a ServiceContract and inherits a ServiceContract from type KeyboardControl_Web.IService1. Contract inheritance can only be used among interface types. If a class is marked with ServiceContractAttribute, it must be the only type in the hierarchy with ServiceContractAttribute. Consider moving the ServiceContractAttribute on type KeyboardControl_Web.IService1 to a separate interface that type KeyboardControl_Web.IService1 implements.

I tried to play different parts of the message, but did not find much useful information.

Here is the code for the different files:

//IService1.vb
Imports System.ServiceModel

' NOTE: If you change the class name "IService1" here, you must also update
'       the reference to "IService1" in Web.config.
<ServiceContract()> _
Public Interface IService1

    <OperationContract()> _
   Function GetAllLocations() As List(Of Address)

End Interface

//Service1.svc.vb
Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Runtime.Serialization
Imports System.ServiceModel
Imports System.Text

' NOTE: If you change the class name "Service1" here, you must also
'       update the reference to "Service1" in Web.config and in the
'       associated .svc file.

Public Class Service1
    Implements IService1
    Public Function GetAllLocations() As List(Of Address) Implements IService1.GetAllLocations
        Dim db As New DataClasses1DataContext()
        Dim matchingCustomers = From cust In db.userControlDemos Select cust
        'Return matchingCustomers.ToList()
    End Function
End Class

I am new to Silverlight / WCF in general, as well as to interfaces and services. Can you guys help me on the right track?

EDIT: I have to add that I am using Visual Studio 2008 in Windows Vista Business SP1.

+3
source share
1 answer

Silverlight Tools Visual Studio, WCF, WCF Silverlight, . Beta 2 (ref: http://timheuer.com/blog/archive/2008/06/06/changes-to-accessing-services-in-silverlight-2-beta-2.aspx).

+1

Source: https://habr.com/ru/post/1702305/


All Articles