我有一个具有多种自己的数据类型的 WCF Web 服务。这种结构不起作用。我可以调用 WSDL,但如果我尝试调用它会抛出异常的方法:
接收对http://adress的 HTTP 响应时出错。这可能是由于服务端点绑定未使用 HTTP 协议。这也可能是由于服务器中止了 HTTP 请求上下文(可能是由于服务关闭)。
我读过这篇文章WCF Web 服务错误:“服务端点绑定不使用 HTTP 协议”?,但我没有找到我的解决方案。我搜索 not set DataMember 并尝试<httpRuntime maxRequestLength..>
在 web.config 中进行设置,但这并没有改变任何东西。我的结构有什么问题?
<ServiceContract(Name:="service", Namespace:="http://namespace")>
Public Interface IService1
<OperationContractAttribute(Action:="http://namespace/methodRequest", name:="method", ReplyAction:="http://namespace/methodResponse")> _
Function method(input As methodRequest) As methodResponse
End Interface
<MessageContract()>
Public Class methodResponse
Public result As Object
<MessageBodyMember(Name:="return", Namespace:="")>
Public Property resultP() As Object
Get
Return Me.result
End Get
Set(value As Object)
Me.result = value
End Set
End Property
End Class
<DataContract()>
Public Class typeArray
Public typeArrayD As ownType()
<DataMember(Name:="value", Order:=1)>
Public Property value() As ownType()
Get
Return typeArrayD
End Get
Set(value As ownType ())
typeArrayD = value
End Set
End Property
End Class
<DataContract()>
Public Class ownType
Private stringValueD As String
<DataMember(Name:="stringValue", Order:=1)>
Public Property stringValue() As String
Get
Return stringValueD
End Get
Set(value As String)
stringValueD= value
End Set
End Property
End Class
<ServiceBehavior(Namespace:="http://namespace", Name:="service")>
Public Class Service1
Implements IService1
Public Function method(input As methodRequest) As methodResponse Implements IService1.method
Dim result As New methodResponse()
result.result = New typeArray
result.result.value = valueOfOwnType
Return result
End Function
End Class