Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/336.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
C# 客户端中的绑定+;周转基金_C#_Wcf_Binding_Client - Fatal编程技术网

C# 客户端中的绑定+;周转基金

C# 客户端中的绑定+;周转基金,c#,wcf,binding,client,C#,Wcf,Binding,Client,我使用VisualStudio11添加服务(添加服务引用)。 添加服务文章时,我有一个articleClient和一个构造函数: public RssArticleServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : base(binding, remoteAddress) { } 如何使用

我使用VisualStudio11添加服务(添加服务引用)。 添加服务文章时,我有一个articleClient和一个构造函数:

public RssArticleServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : 
            base(binding, remoteAddress) {
    }
如何使用这个构造函数,我不知道应该使用哪个绑定值

任何例子或样品请

谢谢

致意


我这样做:

BasicHttpSecurityMode securitymode = BasicHttpSecurityMode.Transport; BasicHttpBinding binding = new BasicHttpBinding(securitymode); binding.MaxReceivedMessageSize = int.MaxValue; binding.MaxBufferSize = int.MaxValue; Uri uri = new Uri("adresse/RssArticleService.svc";); _clientArticles = new RssArticleServiceClient(binding, new EndpointAddress("adresse/RssArticleService.svc";)); var result=await _clientArticles.GetRssDataAsync("1", "fr");
一个cath发现了这个错误:

**here was no endpoint listening at adresse/RssArticleService.svc that could accept the message. This is often caused by an incorrect address or SOAP**

我能做什么,我应该改变绑定的类型吗?

这是我的实现:

BasicHttpSecurityMode securitymode = HostSource.Scheme.Equals("https", StringComparison.InvariantCultureIgnoreCase) ? BasicHttpSecurityMode.Transport : BasicHttpSecurityMode.None;
BasicHttpBinding binding = new BasicHttpBinding(securitymode);
binding.MaxReceivedMessageSize = int.MaxValue;
binding.MaxBufferSize = int.MaxValue;

Uri uri = new Uri(Application.Current.Host.Source, "../service.svc");
_client = new RssArticleServiceClient(binding, new EndpointAddress(uri))
编辑:您需要在web.config中添加以下内容:

<system.serviceModel> 
<services>
  <service name="namespace.RssArticleService"
           behaviorConfiguration="RssArticleServiceBehavior">
    <endpoint address=""
              binding="basicHttpBinding"
              contract="namespace.IRssArticleService"/>
  </service>
</services>
<serviceBehaviors>
   <behavior name="RssArticleServiceBehavior">
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
   </behavior>
 </serviceBehaviors>
 <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
</system.serviceModel>

BasicHttpSecurityMode securitymode=BasicHttpSecurityMode.Transport;BasicHttpBinding=新的BasicHttpBinding(securitymode);binding.MaxReceivedMessageSize=int.MaxValue;binding.MaxBufferSize=int.MaxValue;Uri=newURI(“);_clientArticles=new RssArticleServiceClient(绑定,新端点地址(”);var result=await_clientArticles.GetRssDataAsync(“1”,“fr”);