【发布时间】:2017-01-28 02:12:08
【问题描述】:
我正在尝试创建我的第一个 WCF 服务应用程序,但无法从 Visual Studio 2015 运行它。
这是我点击运行时遇到的错误...
我正在关注一个教程,我认为他们跳过了几个步骤,但这是我添加到 web.config 中的内容
<services>
<service name="OnPatrolRest.Service1">
<endpoint address="http://localhost:51964/service1"
binding="webHttpBinding"
contract="OnPatrolRest.IService1"/>
</service>
</services>
这是界面
<ServiceContract()>
Public Interface IService1
<OperationContract()>
Function GetData(ByVal value As Integer) As String
<OperationContract()>
Function GetDataUsingDataContract(ByVal composite As CompositeType) As CompositeType
<OperationContract()>
<WebInvoke(Method:="GET", ResponseFormat:=WebMessageFormat.Json, UriTemplate:="/getPerson?id={id}")>
Function getPerson(ByVal id As String) As Person
End Interface
对于类文件...
Public Function getPerson(ByVal id As String) As Person Implements IService1.getPerson
Dim p As New Person
p.Id = Convert.ToInt32(id)
p.Name = "Sterling Archer"
Return p
End Function
这是我添加的唯一功能。我错过了什么。我对此很陌生。我看到的每个帖子都是几年前的,在 VS 2015 中不起作用。
非常感谢您的帮助!!!
【问题讨论】:
标签: vb.net wcf visual-studio-2015