C# SOAP HTTPS服务在c中使用#

C# SOAP HTTPS服务在c中使用#,c#,soap,basichttpbinding,C#,Soap,Basichttpbinding,我正在尝试使用HTTPS SOAP服务,该服务具有授权证书,并出现以下错误: mscorlib.dll中发生类型为“System.ServiceModel.ProtocolException”的未处理异常 附加信息:内容类型text/html;响应消息的charset=utf-8与绑定的内容类型(text/xml;charset=utf-8)不匹配。如果使用自定义编码器,请确保正确实现IsContentTypeSupported方法。响应的前1024个字节是:' 下面是绑定。我遗漏了什么吗 &l

我正在尝试使用HTTPS SOAP服务,该服务具有授权证书,并出现以下错误:

mscorlib.dll中发生类型为“System.ServiceModel.ProtocolException”的未处理异常

附加信息:内容类型text/html;响应消息的charset=utf-8与绑定的内容类型(text/xml;charset=utf-8)不匹配。如果使用自定义编码器,请确保正确实现IsContentTypeSupported方法。响应的前1024个字节是:'

下面是绑定。我遗漏了什么吗

<endpoint address="https://...."
          binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IInboundService1"
          contract="RQSInboundExternal.IInboundService" name="BasicHttpBinding_IInboundServiceQSPort">

<basicHttpBinding>              
            <binding name="BasicHttpBinding_IInboundService1" >                  
              <security mode="Transport" >
               <transport clientCredentialType="Basic"/>                   
              </security>
            </binding>
        </basicHttpBinding>

在此处设置用户名和密码。这也需要发送。如果我们只发送标题,它将不起作用

client.ClientCredentials.UserName.UserName = "";
client.ClientCredentials.UserName.Password = "";

var httpRequestProperty = new HttpRequestMessageProperty();
httpRequestProperty.Headers[HttpRequestHeader.Authorization] = "Basic " + Convert.ToBase64String(Encoding.ASCII.GetBytes(client.ClientCredentials.UserName.UserName + ":" + client.ClientCredentials.UserName.Password));
            client.Open();
            var context = new OperationContext(client.InnerChannel);
            using (new OperationContextScope(context))
            {
                context.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = httpRequestProperty;

                client.SampleMethodCall();
            }

听起来好像您试图从资源中使用XML,但它返回了一个HTML页面。是的。我必须通过邮件头发送凭据。我需要怎么发送?我得到一个注销页面回来。当凭据不匹配时会发生这种情况。但同样的Credentail也适用于soupui和browser。