小编use*_*837的帖子

WCF:提供的URI方案"https"无效; 预计'http'.参数名称:当我调用IInternal proxy = factory.CreateChannel()时的via; 在客户端

服务器的App.config:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.web>
    <compilation debug="true"/>
  </system.web>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="NewBehaviour">
          <serviceMetadata httpsGetEnabled="True"/>
          <serviceDebug includeExceptionDetailInFaults="True"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
      <wsHttpBinding>
        <binding name="Binding">
          <security mode="Transport">
            <transport clientCredentialType="None"></transport>
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>

    <services>
      <service name="Server.InternalClass" behaviorConfiguration="NewBehaviour">
        <endpoint address="IInternal" binding="wsHttpBinding" bindingConfiguration="Binding" contract="Common.IInternal">
          <identity>
            <dns value="MyMachine"/>
          </identity>
        </endpoint>
       <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/> 
        <host>
          <baseAddresses>
            <add baseAddress="https://MyMachine:8733/"/>
          </baseAddresses>
        </host>
      </service>
    </services>
  </system.serviceModel>


</configuration>
Run Code Online (Sandbox Code Playgroud)

客户

static ChannelFactory<IInternal> factory = new ChannelFactory<IInternal>(new WSHttpBinding(), new EndpointAddress("https://MyMachine:8733/IInternal"));
Run Code Online (Sandbox Code Playgroud)

当我调用方法factory.CreateChannel()时,我得到错误

我配置证书

在此输入图像描述

c# wcf

6
推荐指数
1
解决办法
9816
查看次数

标签 统计

c# ×1

wcf ×1