【问题标题】:Error while deploying webservice. Could not find a base address that matches scheme http for the endpoint with binding BasicHttpBinding部署 Web 服务时出错。找不到与具有绑定 BasicHttpBinding 的端点的方案 http 匹配的基地址
【发布时间】:2018-01-18 21:11:57
【问题描述】:

我一直在尝试在生产 IIS 服务器中的 .NET 3.5 中部署一个简单的同步服务(使用 VS2008 的 WCF 服务库实现)。在部署和测试它时,它抛出了以下错误:

“找不到与绑定 BasicHttpBinding 的端点的方案 http 匹配的基地址。注册的基地址方案是 [https]。”

这是 web.config

<system.serviceModel>
    <serviceHostingEnvironment>
        <baseAddressPrefixFilters>
            <add prefix="http://194.165.0.8:80/"/>
        </baseAddressPrefixFilters>
    </serviceHostingEnvironment>
    <bindings>
<basicHttpBinding>
    <binding name="basicHttpBindingConfiguration">
        <security mode="None">
        </security>
    </binding>       
</basicHttpBinding>
</bindings>
    <services>
        <service name="MobileSyncServiceLibrary.AdventureWorksSyncService" behaviorConfiguration="MobileSyncServiceLibrary.AdventureWorksSyncServiceBehavior">
             <endpoint  address="http://194.165.0.8:80/PruebaWS/MobileSyncServiceLibrary.AdventureWorksSyncService.svc" binding="basicHttpBinding"  contract="MobileSyncServiceLibrary.IAdventureWorksSyncContract" bindingConfiguration="basicHttpBindingConfiguration"/>
             <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
            </service>
        </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="MobileSyncServiceLibrary.AdventureWorksSyncServiceBehavior">
            <serviceMetadata httpGetEnabled="true" />
            <serviceDebug includeExceptionDetailInFaults="False" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    </system.serviceModel>
    <system.webServer>
        <defaultDocument>
            <files>
                <remove value="Default.htm" />
                <remove value="Default.asp" />
                <remove value="index.htm" />
                <remove value="index.html" />
                <remove value="iisstart.htm" />
                <remove value="default.aspx" />
                <add value="MobileSyncServiceLibrary.AdventureWorksSyncService.svc" />
            </files>
        </defaultDocument>
    </system.webServer>

我已经完成了大多数帖子中关于这个问题的解决方案:

设置安全模式=无

设置 httpsGetEnabled="false"

我看到的所有答案,都指向这两个设置,但我一直无法修复配置上的错误。

关于我缺少什么或我需要改变什么的任何想法?这是服务正在抛出的当前异常。

[ServiceActivationException: 服务“/PruebaWS/MobileSyncServiceLibrary.AdventureWorksSyncService.svc”由于编译过程中的异常而无法激活。异常消息是:找不到与绑定 BasicHttpBinding 的端点的方案 http 匹配的基地址。注册的基地址方案是 [https]..] System.Runtime.AsyncResult.End(IAsyncResult 结果) +594083 System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult 结果) +238 System.ServiceModel.Activation.HttpModule.ProcessRequest(对象发送者,EventArgs e)+327 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +142 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +92

这是网站上的当前绑定。

【问题讨论】:

  • baseAddress="xxx.xxx.x.x/xxxxx/,can 你用一些实数替换这个虚拟 IP。
  • @Hameed 按照您的要求完成
  • 如果您在 IIS 中托管 wcf 服务,则必须使用基址前缀过滤器。但我没有看到任何 .svc 服务,而且 IIS 也不支持 net.tcp 绑定。您能再检查一次吗?跨度>
  • 删除了 net.tcp 过滤器。在此之前它有一个多重绑定异常,我只是粘贴了答案。它不是必需的。还添加了默认文档部分,以便显示确实指向 svc。也添加了 IIS 正在抛出的当前异常。
  • 已编辑以清理 xml 并消除不必要的代码

标签: web-services wcf web-config iis-7.5


【解决方案1】:

好的。找到了解决方案。我误读了多重绑定解决方案。

我阅读了以下部分,告诉站点我将服务指向哪个绑定。

<serviceHostingEnvironment>
        <baseAddressPrefixFilters>
            <add prefix="http://194.165.0.8:80/"/>
        </baseAddressPrefixFilters>
    </serviceHostingEnvironment>

当根据这个答案完全相反时。

https://social.msdn.microsoft.com/Forums/vstudio/en-US/03687d4d-87dd-44b3-b945-05787ea93bd0/could-not-find-a-base-address-that-matches-scheme-http-for-the-endpoint-with-binding?forum=wcf

问题是我造成的,服务被重定向到 https 绑定

所以我把前缀改成https://194.165.0.8:443来过滤掉https并将其发送到http连接。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-06-02
    • 1970-01-01
    • 1970-01-01
    • 2021-06-02
    • 2011-10-14
    • 2012-04-06
    • 1970-01-01
    相关资源
    最近更新 更多