C# 从另一个调用https服务

C# 从另一个调用https服务,c#,asp.net,wcf,C#,Asp.net,Wcf,我正在尝试使用自定义C#代码从另一个WCF调用web服务。但是,当我运行代码时,会出现以下错误: 但是,当我从Asp.net页面运行它时,它成功地执行了 这是我的服务网络配置文件 <?xml version="1.0"?> <configuration> <appSettings> <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true"/> <

我正在尝试使用自定义C#代码从另一个WCF调用web服务。但是,当我运行代码时,会出现以下错误:

但是,当我从Asp.net页面运行它时,它成功地执行了

这是我的服务网络配置文件

<?xml version="1.0"?>
<configuration>
  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true"/>
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.5.2"/>
    <httpRuntime targetFramework="4.5.2"/>
    <httpModules>
      <add name="ApplicationInsights" type="Microsoft.ApplicationInsights.Telemetry.Web.ApplicationInsightsModule"/>
      <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web"/>
    </httpModules>
  </system.web>
  <connectionStrings>
    <add name="TesString" connectionString="Data Source=(localdb)\Kentico;Initial Catalog=MYDB;Integrated Security=True"
  providerName="System.Data.SqlClient"/>
  </connectionStrings>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BillUploadSoap1"/>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="https://testapp2.com/ssb/financial/billupload.asmx" binding="basicHttpBinding" bindingConfiguration="BillUploadSoap1"
    contract="SCTHSadad.BillUploadSoap" name="BillUploadSoap1"/>
    </client>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <protocolMapping>
      <add binding="basicHttpsBinding" scheme="https"/>
    </protocolMapping>    
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true">
  <remove name="ApplicationInsightsWebTracking"/>
  <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web"
    preCondition="managedHandler"/>
    </modules>
<!--
    To browse web app root directory during debugging, set the value below to true.
    Set to false before deployment to avoid disclosing web app folder information.
  -->
    <directoryBrowse enabled="true"/>
    <validation validateIntegratedModeConfiguration="false"/>
  </system.webServer>


我认为您正在尝试将
asmx
web服务作为
WCF
服务在您的客户机中使用

添加服务引用时,请尝试以下操作-


并删除客户端应用程序中的所有配置和绑定信息

我认为您正试图将
asmx
web服务作为
WCF
服务在您的客户机中使用

添加服务引用时,请尝试以下操作-


并删除客户端应用程序中的所有配置和绑定信息

您的配置可能错误。你能把它和问题一起发布到这里吗?谢谢你的支持,我现在已经添加了它。请尝试http而不是https,endpoint address=“”错误::(System.Web.Services.Protocols.SoapException:服务器无法处理请求。-->System.ArgumentException:给定的URI必须是绝对的。发布c代码..你的配置可能是错误的。您可以将其与问题一起发布到此处吗?感谢您的支持,我现在已经添加了它。请尝试http而不是https,endpoint address=“”错误::(System.Web.Services.Protocols.SoapException:服务器无法处理请求。-->System.ArgumentException:给定的URI必须是绝对的。发布c#代码。。