我正在尝试使用自定义C#代码从另一个WCF调用Web服务。但是,当我运行我的代码时,我收到以下错误:
然而,当我从Asp.net页面运行它时,它执行成功。
这是我的服务webconfig文件
<?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>