C# 使用Powershell使用wshttpbinding使用WCF服务

C# 使用Powershell使用wshttpbinding使用WCF服务,c#,wcf,powershell-4.0,C#,Wcf,Powershell 4.0,我正在尝试使用Powershell使用WCF服务。当我使用basichttpbinding时,我可以使用以下命令来使用它,而不会出现问题 $MyWcfService=新的WebServiceProxy-UseDefaultCredential-Uri“” $MyWcfService.HelloWorld() 但是,当我将绑定更改为wshttpbinding时,会出现以下错误 使用“0”参数调用“HelloWorld”时出现异常:“基础连接已关闭:意外错误。” 在接收时发生。” 第1行字符:1

我正在尝试使用Powershell使用WCF服务。当我使用basichttpbinding时,我可以使用以下命令来使用它,而不会出现问题

$MyWcfService=新的WebServiceProxy-UseDefaultCredential-Uri“”

$MyWcfService.HelloWorld()

但是,当我将绑定更改为wshttpbinding时,会出现以下错误

使用“0”参数调用“HelloWorld”时出现异常:“基础连接已关闭:意外错误。” 在接收时发生。”

第1行字符:1

  • $TestService.HelloWorld()
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    • CategoryInfo:NotSpecified:(:)[],MethodInvocationException
    • FullyQualifiedErrorId:WebException

如何使用wshttpbinding使用WCF服务?

该服务位于
http://localhost:8733/TestService?wsdl
是否设置为接受wsHttpBindings?你能发布服务的配置文件吗?是的,它设置为访问wsHttpBindings,我可以使用用c#w/o编写的客户端使用WCF有问题吗?我需要使用需要cookies进行身份验证的WS,因此我需要配置wsHttpBinding。