English 中文(简体)
您如何将“世界妇女论坛”的服务与两个终点混为一谈,以便每个终点使用不同的名单Uri?
原标题:How do you configure a WCF service with two endpoints to use a different ListenUri for each endpoint?

我有一个WCF服务公司,它使用webHttpBled暴露了终点,并且由WPF和ASP消费。 NET应用软件。 一切都发挥了巨大作用。

我现在试图从视窗电话(WP7)中提取服务。 然而,由于“NET”框架尚未达到WP7,<代码>。 系统。 Web namespace is unavailable with result that webHttpBinding WP7没有工作。

现在,如果我把<代码>webHttpBled从basicHttpBled上转,则电话申请工作。

我不想重订我的计生联和伙伴关系。 http://www.ohchr.org。

我的理解是,世界投资基金能够支持多个约束性文书,我曾试图召集和管理这一服务,以便暴露webHttpBled和basicHttpBled的终点。 这项服务似乎开始罚款。 然而,WPF & ASP。 该网络的申请无法查阅。 在我试图在工作计划7申请中设立一个服务参考资料时,我收到以下信息:

A binding instance has already been associated to listen URI http://localhost:1726/GeneralService.svc . If two endpoints want to share the same ListenUri, they must also share the same binding object instance. The two conflicting endpoints were either specified in AddServiceEndpoint() calls, in a config file, or a combination of AddServiceEndpoint() and config.

一位同事和我对<代码> 底线/代码>、<代码>address和<编码>在无任何uck的情况下对密码>进行了各种改动。 我们现在正处在审判和错误的关头,这些错误证明非常有效。

<system.serviceModel>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
    <bindings>
        <basicHttpBinding>
            <binding name="generalBasic" />
        </basicHttpBinding>
        <webHttpBinding>
            <binding name="general" maxReceivedMessageSize="2147483647">
                <readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647" />
                <security mode="None">
                    <transport clientCredentialType="None" />
                </security>
            </binding>
        </webHttpBinding>
    </bindings>
    <behaviors>
        <serviceBehaviors>
            <behavior>
                <serviceMetadata httpGetEnabled="true"/>
                <serviceDebug includeExceptionDetailInFaults="false" />
            </behavior>
        </serviceBehaviors>
        <endpointBehaviors>
            <behavior name="web">
                <webHttp />
            </behavior>
        </endpointBehaviors>
    </behaviors>
    <services>
        <service name="MyProject.GeneralService">
            <endpoint address="mex" 
                binding="mexHttpBinding"
                contract="IMetadataExchange" />
            <endpoint address="" 
                binding="basicHttpBinding" 
                bindingConfiguration="generalBasic"
                contract="MyProject.Contracts.IGeneralService" />
            <endpoint behaviorConfiguration="web" 
                binding="webHttpBinding"
                bindingConfiguration="general" 
                contract="MyProject.Contracts.IGeneralService" />
            <host>
                <baseAddresses>
                    <add baseAddress="http://localhost:1726/" />
                </baseAddresses>
            </host>
        </service>
    </services>
</system.serviceModel>
最佳回答

仅具体说明对基本或网络“终端点”具有价值的地址,以区别其地址。 注

<endpoint behaviorConfiguration="web" address="rest" binding="webHttpBinding" bindingConfiguration="general" contract="MyProject.Contracts.IGeneralService" /> 

解决你的问题

问题回答

在界定您的结尾点时,请具体说明address=>,而第二点则具有任何价值(......)。 因此,即便如此,我们也会以<代码>“”地址发言。

<endpoint address="" 
            binding="basicHttpBinding" 
            bindingConfiguration="generalBasic"
            contract="MyProject.Contracts.IGeneralService" />
        <endpoint behaviorConfiguration="web" 
            binding="webHttpBinding"
            bindingConfiguration="general" 
            contract="MyProject.Contracts.IGeneralService" />

因此,在这种情况下,当我们把地址定为空洞时,它将采取违约基调。

因此,试图确定最终点对任何人的价值。 因此,我们将对这2个终点有不同的地址。

<endpoint address="" 
            binding="basicHttpBinding" 
            bindingConfiguration="generalBasic"
            contract="MyProject.Contracts.IGeneralService" />
        <endpoint behaviorConfiguration="web" address="WP7Service" 
            binding="webHttpBinding"
            bindingConfiguration="general" 
            contract="MyProject.Contracts.IGeneralService" />

So our new endpoints address are:

  1. http://localhost:1726/GeneralService.svc
  2. http://localhost:1726/GeneralService.svc/WP7Service

For usage service on WP you should expose your service with Rest, Soap or OData endpoints. In the link below it is quite clear described how to expose WCF RIA for such purposes:
Exposing WCF (SOAPWSDL) Services
It works great for me.

我所缺的是protocolMapping,涉及两个终点:

<configuration>
  <!--...-->
  <system.serviceModel>
    <!--...-->
    <protocolMapping>
      <add binding="basicHttpBinding" scheme="http" bindingConfiguration="BasicHttpBindingConfiguration"/>
      <add binding="basicHttpsBinding" scheme="https" bindingConfiguration="SecureHttpBindingConfiguration"/>
    </protocolMapping>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBindingConfiguration" />
        <binding name="SecureHttpBindingConfiguration" >
          <security mode="Transport">
            <transport clientCredentialType="None" proxyCredentialType="None"/>
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <services>
      <service name="Namespace.ServiceName">
        <endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpBindingConfiguration"
          contract="Namespace.IServiceName" />
      </service>
      <service name="Namespace.ServiceName">
        <endpoint address="" binding="basicHttpsBinding" bindingConfiguration="BasicHttpsBindingConfiguration"
          contract="Namespace.IServiceName" />
      </service>
    </services>
    <!--...-->
  </system.serviceModel>
  <!--...-->
</configuration>




相关问题
WCF DataMember Serializing questions

Ok, so I was part way through the long winded process of creating DTOs for sending my model over the wire and I don t feel like I m going down the right route. My issue is that most of the entities ...

Access WCF service on same server

I have a .NET website with a WCF service. How do I access the current operations context of my service? One possible work around is to just make a call to the service within the app...but that seems ...

WCF binding error

So I got into work early today and got the latest from source control. When I try to launch our ASP.NET application, I get this exception: "The binding at system.serviceModel/bindings/wsHttpBinding ...

The service operation requires a transaction to be flowed

I am facing strange issue with our WCF service. The same code was working fine until recently we added more OperationContracts(Web Methods). We have common 3 tier architecture. DAL (WCF) BLL Web ...

热门标签