简体   繁体   English

WCF从基本转到wsHttpBinding

[英]WCF Going from Basic to wsHttpBinding

I have gotten my config to work correctly now, there was a mismatch between the actual file structure and the project structure in visual studio. 我的配置现在可以正常工作,Visual Studio中的实际文件结构和项目结构之间不匹配。 Stupid silly mistake :) 愚蠢的愚蠢错误:)

However, now I have the issue of transitioning from basicHttpBinding to WsHttpBinding. 但是,现在我遇到了从basicHttpBinding过渡到WsHttpBinding的问题。 This is the webconfig. 这是webconfig。 As you can see I have changed the first endpoint to be of the type wsHttpBinding. 如您所见,我将第一个端点更改为wsHttpBinding类型。

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <connectionStrings>
    <add name="RENTIT05ConnectionString" connectionString="Data Source=rentit.itu.dk;Initial Catalog=RENTIT05;Persist Security Info=True;User ID=Rentit05db;Password=omitted" providerName="System.Data.SqlClient" />
    <add name="RENTIT05Entities" connectionString="metadata=res://*/RentIt.csdl|res://*/RentIt.ssdl|res://*/RentIt.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=rentit.itu.dk;Initial Catalog=RENTIT05;Persist Security Info=True;User ID=Rentit05db;Password=omitted;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>
  <system.web>
    <httpRuntime executionTimeout="3600" maxRequestLength="10000000"/>
    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
      </assemblies>
    </compilation>
    <customErrors mode="Off" />
  </system.web>

  <system.serviceModel>
    <services>
      <service name="RentIt05.Services.Service" behaviorConfiguration="ServiceBehavior">
        <endpoint address="RentIt05.Services.AgeRatingService" binding="wsHttpBinding" bindingConfiguration="wsHttpBinding" contract="RentIt05.Interfaces.IAgeRatingService"></endpoint>
        <endpoint address="RentIt05.Services.CommentService" binding="basicHttpBinding" bindingConfiguration="RentItBinding"  contract="RentIt05.Interfaces.ICommentService"></endpoint>
        <endpoint address="RentIt05.Services.ItemService" binding="basicHttpBinding" bindingConfiguration="RentItBinding"  contract="RentIt05.Interfaces.IItemService"></endpoint>
        <endpoint address="RentIt05.Services.ItemTypeService" binding="basicHttpBinding" bindingConfiguration="RentItBinding"  contract="RentIt05.Interfaces.IItemTypeService"></endpoint>
        <endpoint address="RentIt05.Services.LabelService" binding="basicHttpBinding" bindingConfiguration="RentItBinding"  contract="RentIt05.Interfaces.ILabelService"></endpoint>
        <endpoint address="RentIt05.Services.LoginService" binding="basicHttpBinding" bindingConfiguration="RentItBinding"  contract="RentIt05.Interfaces.ILoginService"></endpoint>
        <endpoint address="RentIt05.Services.RatingService" binding="basicHttpBinding" bindingConfiguration="RentItBinding"  contract="RentIt05.Interfaces.IRatingService"></endpoint>
        <endpoint address="RentIt05.Services.SectionService" binding="basicHttpBinding" bindingConfiguration="RentItBinding"  contract="RentIt05.Interfaces.ISectionService"></endpoint>
        <endpoint address="RentIt05.Services.StateLogService" binding="basicHttpBinding" bindingConfiguration="RentItBinding"  contract="RentIt05.Interfaces.IStateLogService"></endpoint>
        <endpoint address="RentIt05.Services.StateService" binding="basicHttpBinding" bindingConfiguration="RentItBinding"  contract="RentIt05.Interfaces.IStateService"></endpoint>
        <endpoint address="RentIt05.Services.UserGroupService" binding="basicHttpBinding" bindingConfiguration="RentItBinding"  contract="RentIt05.Interfaces.IUserGroupService"></endpoint>
        <endpoint address="RentIt05.Services.UserService" binding="basicHttpBinding" bindingConfiguration="RentItBinding"  contract="RentIt05.Interfaces.IUserService"></endpoint>
        <endpoint address="RentIt05.Services.TransferService" binding="basicHttpBinding" bindingConfiguration="RentItBinding"  contract="RentIt05.Interfaces.ITransferService"></endpoint>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="ServiceBehavior">
          <serviceThrottling maxConcurrentCalls="1000" maxConcurrentSessions="1000" maxConcurrentInstances="1000"/>
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
     <bindings>
       <basicHttpBinding>
         <binding name="RentItBinding" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" transferMode="StreamedRequest">
           <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
         </binding>
       </basicHttpBinding>
      <wsHttpBinding>
        <binding name="wsHttpBinding">
          <security mode="Transport">
            <transport clientCredentialType="None" />
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true" />
  </system.webServer>
</configuration>

When I try to run this locally on localhost, I get the following error message: 当我尝试在localhost上本地运行此命令时,出现以下错误消息:

Could not find a base address that matches scheme https for the endpoint with binding WSHttpBinding. Registered base address schemes are [http].. 

I have found some artiles talking about IIS resolving multiple base addresses, but this is locally, so I don't know why it is not working. 我发现一些专家在谈论IIS解析多个基址,但这是本地的,所以我不知道为什么它不起作用。

Is there something I'm missing here? 我在这里想念什么吗? The config file works fine as long as I only use basicHttpBindings. 只要我只使用basicHttpBindings,配置文件就可以正常工作。

Any help will be greatly appreciated, tyvm! 任何帮助将不胜感激,tyvm!

Do you need security enabled? 您需要启用安全性吗? You have transport security enabled on the wsHttpBinding which will look for ssl. 您已在wsHttpBinding上启用了传输安全性,它将查找ssl。 Your basicHttpBinding isn't using any. 您的basicHttpBinding没有使用任何。 The error will go away if you set 如果您设置错误,错误将消失

    <binding name="wsHttpBinding">
      <security mode="None">

      </security>
    </binding>

Another option is to set up ssl on IIS. 另一种选择是在IIS上设置ssl。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM