WCF元数据包含无法解析的引用,转换为HTTPS时出错



im对此WCF Web服务有问题。我试着让它在HTTPS中运行,在HTTP中正常运行。我收到这个错误:

https://localhost:8733/Design_Time_Addresses/WebServiceOppLink/Service1/mex Metadata contains a reference that cannot be resolved: 'https://localhost:8733/Design_Time_Addresses/WebServiceOppLink/Service1/mex'. An error occurred while making the HTTP request to https://localhost:8733/Design_Time_Addresses/WebServiceOppLink/Service1/mex. This could be due to the fact that the server certificate is not configured properly with HTTP.SYS in the HTTPS case. This could also be caused by a mismatch of the security binding between the client and the server. The underlying connection was closed: An unexpected error occurred on a send. Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. An existing connection was forcibly closed by the remote hostHTTP GET Error URI: https://localhost:8733/Design_Time_Addresses/WebServiceOppLink/Service1/mex There was an error downloading 'https://localhost:8733/Design_Time_Addresses/WebServiceOppLink/Service1/mex'. The underlying connection was closed: An unexpected error occurred on a send. Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. An existing connection was forcibly closed by the remote host


在我将协议更改为HTTPS后出现此问题
这是我的应用程序。配置


<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<customErrors mode="Off"/>
<compilation debug="true" />
</system.web>
<connectionStrings>
<add name="DatabaseConnection" connectionString="Data Source=testserver2\maximizer;Initial Catalog=financial;Persist Security Info=True;User ID=sa;Password=loiranoia" providerName="System.Data.SqlClient" />
</connectionStrings>
<!-- When deploying the service library project, the content of the config file must be added to the host's 
app.config file. System.Configuration does not support config files for libraries. -->
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="secureHttpBinding">
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="WebServiceOppLink.Service1" behaviorConfiguration="metadataBehavior" >
<host>
<baseAddresses>
<add baseAddress = "https://localhost:8733/Design_Time_Addresses/WebServiceOppLink/Service1/" />
</baseAddresses>
</host>
<!--
<endpoint address="" 
binding="wsHttpBinding" 
contract="WebServiceOppLink.IService1">
</endpoint>
<endpoint address="mex" 
binding="mexHttpBinding" 
contract="IMetadataExchange"/>
!-->
<endpoint address=""
binding="basicHttpBinding"
bindingConfiguration="secureHttpBinding"
contract="WebServiceOppLink.IService1">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex"
binding="mexHttpsBinding"
contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="metadataBehavior">
<useRequestHeadersForMetadataAddress>
<defaultPorts>
<!-- Use your own port numbers -->
<add scheme="http" port="80" />
<add scheme="https" port="443" />
</defaultPorts>
</useRequestHeadersForMetadataAddress>
<!-- To avoid disclosing metadata information, 
set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="True" httpsGetEnabled="True"/>
<!-- To receive exception details in faults for debugging purposes, 
set the value below to true.  Set to false before deployment 
to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>


看起来它正在尝试使用HTTPMEX访问HTTPS URL。但这只是猜测。。你们能帮我做这个吗?干杯W

尝试添加

<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>

system.serviceModel内部

我自己解决了两个问题,第一个连接字符串错误

"Data Source=testserver2\maximizer

它有2个"\"其次,Visual Studio不能信任自己的证书,但它在具有有效证书的计算机上运行。

我没有时间浪费在修复visualstudio上。

感谢

欢呼

最新更新