2009-01-27 87 views
3

编辑:因为我解决了这个问题,所以我对这个问题开始了一个封闭的投票。我做的一切都很好,但是我刚刚下载并卸载的ASP URL重写器的引用仍然在IIS中有一个参考。这个论坛发布的Waclaw Stypula(与步骤一)帮助我跟踪这个意外。当我启动运行命令时,IIS告诉我它(显然)找不到重写器DLL。我删除了参考文件,然后应用程序正常运行。如何正确设置启用Silverlight的WCF服务?


我被Jesse Libertysilverlight.net教程。目前我正在尝试做tutorial three,但我正在标题“CREATE THE WEB SERVICE”(大约下半部分)下面跑到墙上。

首先,当我通过将新服务添加到解决方案来创建新服务时,本教程指出应创建三个文件; IService1.vb,Service1.svcService1.svc.vb。将服务添加到解决方案时,我没有收到IService1.vb文件。我downloaded他们提供的项目的副本,和Service1.svc.vb文件在那里,所以我手动添加一个并复制文件的内容。该教程说这是一个VB教程,但在附带的截图displays C#,所以也许这是问题。

后,我得到由像教程中的所有文件(复制/粘贴,以确保我没有一个错字),我尝试添加服务引用,并出现以下错误:

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.

我试着用谷歌搜索邮件的不同部分,但没有找到太多有用的信息。

下面是不同文件的代码:我是新来的Silverlight/WCF一般,以及对接口和服务

//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 

。你们能帮助我走上正轨吗?

编辑:我应该补充说我在Windows Vista Business SP1上使用Visual Studio 2008。

回答