Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wcf 端点重复,但我看不到它_Wcf_Wcf Binding - Fatal编程技术网

Wcf 端点重复,但我看不到它

Wcf 端点重复,但我看不到它,wcf,wcf-binding,Wcf,Wcf Binding,我有一个网络服务 这是(我的)我的web配置的一部分: <system.serviceModel> <behaviors> <serviceBehaviors> <behavior name="LicensedBehaviour"> <serviceMetadata httpGetEnabled="true" /> <serviceDebug includ

我有一个网络服务

这是(我的)我的web配置的一部分:

<system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="LicensedBehaviour">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
        <behavior name="NetTCPBehaviour">
          <serviceTimeouts transactionTimeout="0.00:00:30" />
          <serviceDebug includeExceptionDetailInFaults="false" />
          <dataContractSerializer maxItemsInObjectGraph="65536" />
          <serviceMetadata httpGetEnabled="true" />
        </behavior>
        <behavior name="">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <services>
      <service name="License" behaviorConfiguration="LicensedBehaviour">
        <endpoint address="License.svc" binding="basicHttpBinding" bindingConfiguration="NormalHttpBindingEndPoint" contract="ILicense" name="wsLicense" />
      </service>
      <service name="testme" behaviorConfiguration="NetTCPBehaviour">
        <endpoint  address="net.tcp://localhost:808/Sync2.svc" binding="netTcpBinding" contract="ISync2" name="wsMotionUploader" bindingConfiguration="NetTCPBindingEndPoint"/>
      </service>
    </services>
    <bindings>
      <basicHttpBinding>
        <binding name="NormalHttpBindingEndPoint" closeTimeout="00:02:00" openTimeout="00:02:00">
          <readerQuotas maxArrayLength="32768" maxStringContentLength="2147483647" />
        </binding>
      </basicHttpBinding>
      <netTcpBinding>
        <binding  name="NetTCPBindingEndPoint" receiveTimeout="00:15:00" sendTimeout="00:15:00" transferMode="Streamed" closeTimeout="00:02:00" openTimeout="00:02:00" 
            maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647">
          <readerQuotas maxArrayLength="32768" />
          <security mode="None">
            <transport clientCredentialType="None" protectionLevel="None" />
            <message clientCredentialType="None" />
          </security>
        </binding>
      </netTcpBinding>
    </bindings>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
这是我的界面:

[OperationContract(IsOneWay = true)]
void DoWork(Stream image);
这是我的客户:

wsSyncFastest.Sync2Client client = new wsSyncFastest.Sync2Client();
using (Bitmap bmp = new Bitmap("d:\\bf.jpg"))
{
    using (MemoryStream ms = new MemoryStream())
    {
         bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
         client.DoWork(ms);
         ms.Close();
    }
}
这是我的错误消息: 无法加载协定“wssyncfaster.ISync2”的终结点配置节,因为找到了该协定的多个终结点配置。请按名称指明首选端点配置部分

这是我的堆栈错误:

位于System.ServiceModel.Description.ConfigLoader.LookupChannel(ContextInformation configurationContext、String configurationName、ContractDescription contract、EndpointAddress address、布尔通配符、布尔useChannelElementKind、ServiceEndpoint和ServiceEndpoint) 位于System.ServiceModel.Description.ConfigLoader.LookupEndpoint(字符串configurationName、EndpointAddress地址、ContractDescription契约、ContextInformation configurationContext) 位于System.ServiceModel.Description.ConfigLoader.LookupEndpoint(字符串configurationName、EndpointAddress地址、ContractDescription contract) 位于System.ServiceModel.ChannelFactory.InitializeEndpoint(字符串配置名称,端点地址) 位于System.ServiceModel.ChannelFactory
1..ctor(字符串endpointConfigurationName,EndpointAddress remoteAddress)
位于System.ServiceModel.ChannelFactory
1..ctor(字符串endpointConfigurationName) 在System.ServiceModel.ConfigurationEndpointTrait
1.CreateSimplexFactory()中
位于System.ServiceModel.ConfigurationEndpointTrait
1.CreateChannelFactory() 位于System.ServiceModel.ClientBase
1.CreateChannelFactoryRef(EndpointTrait
1 EndpointTrait) 在System.ServiceModel.ClientBase
1.InitializeChannelFactoryRef()中
在System.ServiceModel.ClientBase上
位于g:\dev20140604\LiteEdition\LiteEdition\Service References\wssyncfaster\Reference.cs中的LiteEdition.wssync2client..ctor()处:第51行
在LiteEdition.StartUp.button1\u单击g:\dev20140604\LiteEdition\LiteEdition\StartUp.cs:第2646行中的(对象发送方,事件参数e)

我看不出有什么问题,但显然有

有人能帮忙吗

其他:

我的客户端app.config:

<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="wsLicense" />
            <binding name="BasicHttpBinding_ISync2" />
        </basicHttpBinding>
        <netTcpBinding>
            <binding name="NetTcpBinding_ISync2" />
        </netTcpBinding>
    </bindings>
    <client>
        <endpoint address="http://aurl/License.svc/License.svc"
            binding="basicHttpBinding" bindingConfiguration="wsLicense"
            contract="wsLicense.ILicense" name="wsLicense" />
        <endpoint address="http://www.informedmotion.co.uk/Sync2.svc"
            binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ISync2"
            contract="wsSyncFastest.ISync2" name="BasicHttpBinding_ISync2" />
        <endpoint address="net.tcp://dsvr019492/Sync2.svc" binding="netTcpBinding"
            bindingConfiguration="NetTcpBinding_ISync2" contract="wsSyncFastest.ISync2"
            name="NetTcpBinding_ISync2">
            <identity>
                <servicePrincipalName value="host/DSVR019492" />
            </identity>
        </endpoint>
    </client>
</system.serviceModel>

在创建代理对象时,请尝试将端点的名称传入,看看是否可以修复它

如果您打算使用basicHttpBinding,它将是:

wsSyncFastest.Sync2Client client = new wsSyncFastest.Sync2Client("BasicHttpBinding_ISync2");
wsSyncFastest.Sync2Client client = new wsSyncFastest.Sync2Client("NetTcpBinding_ISync2");
如果您打算使用netTcpBinding,则:

wsSyncFastest.Sync2Client client = new wsSyncFastest.Sync2Client("BasicHttpBinding_ISync2");
wsSyncFastest.Sync2Client client = new wsSyncFastest.Sync2Client("NetTcpBinding_ISync2");

嗨,谢谢你的发帖。我不确定我会在哪里这样做。我已将客户端端点配置添加到我的原始问题中。请给我举个例子好吗?ThanksI编辑了答案以包含示例。端点名称位于客户端应用程序配置中。由于您有两个为同一协定提供服务的终结点,因此客户端代理对象将不知道要使用哪个终结点,除非您在生成一个终结点时在构造函数中指定它。客户端的终结点地址不正确。它应该有一个“License.svc”嗨,我一回到家就会测试:)谢谢让我重新措辞,客户端app.config中的第一个端点地址条目在“address”的值中有两个License.svc是不正确的。另外两个看起来不错。