提供的URI方案“https”无效;预计'http'。参数名称:via in developpement

时间:2017-03-27 17:14:50

标签: c# asp.net-mvc ssl wsdl

尝试调用wsdl的函数时出现此错误。我在我的解决方案中为项目添加了ServiceReference。在该项目中,我有以下app.config文件

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="MYSERVICENAME_ws_Authorization_Binder" closeTimeout="00:01:00"
                openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                useDefaultWebProxy="true">
                <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                <security mode="Transport">
                    <transport clientCredentialType="Basic" proxyCredentialType="Basic"
                        realm="" />
                    <message clientCredentialType="UserName" algorithmSuite="Default" />
                </security>
            </binding>
        </basicHttpBinding>
    </bindings>
    <client>
        <endpoint address="MYSERVICEURL"
            binding="basicHttpBinding" bindingConfiguration="MYSERVICENAME_ws_Authorization_Binder"
            contract="MYSERVICE.Authorization_PortType" name="MYSERVICENAME_ws_Authorization_Port" />
    </client>
</system.serviceModel>
<system.diagnostics>
    <sources>
        <source name="System.ServiceModel.MessageLogging">
            <listeners>
                <add name="messages"
                type="System.Diagnostics.XmlWriterTraceListener"
                initializeData="c:\logs\messages.svclog" />
            </listeners>
        </source>
    </sources>
</system.diagnostics>
<system.serviceModel>
    <diagnostics>
        <messageLogging
             logEntireMessage="true"
             logMalformedMessages="true"
             logMessagesAtServiceLevel="true"
             logMessagesAtTransportLevel="true"
             maxMessagesToLog="3000"
             maxSizeOfMessageToLog="2000"/>
    </diagnostics>
</system.serviceModel>

然后在我的主项目MVC项目中,我在Web.config文件中有以下内容。

<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="MYSERVICENAME_ws_Authorization_Binder" />
        </basicHttpBinding>
    </bindings>
    <client>
        <endpoint address="MYSERVICEURL"
            binding="basicHttpBinding" bindingConfiguration="MYSERVICENAME_ws_Authorization_Binder"
            contract="MYSERVICE.Authorization_PortType" name="MYSERVICENAME_ws_Authorization_Port" />
    </client>
</system.serviceModel>

当我在调试模式localhost下运行时,会发生错误。我还没有在我的网站上尝试过,因为我还在开发中。我的网站已经过认证SSL,我的localhost也配置为在HTTPS上运行,但只能使用自签名证书。

我收到此错误是因为我的自签名证书还不够吗?我可以localhost使用我的网站使用的SSL吗?如果没有,那么最佳解决方案是什么?我发现了一些关于此错误的帖子,但还没有找到帮助我的解决方案。

0 个答案:

没有答案