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
C# 窗口应用程序调用WCF时出错_C#_Wcf - Fatal编程技术网

C# 窗口应用程序调用WCF时出错

C# 窗口应用程序调用WCF时出错,c#,wcf,C#,Wcf,我已经开发了窗口应用程序,我在特定的时间间隔调用WCF,但是通过WCF将数据插入数据库中没有错误,但在日志条目中,我得到了一个关于WCF端点的错误,如下所示 2011-22-09 10:16>>错误:没有端点侦听 可以接受消息的myserviceUrl(.svc)。这是经常发生的事 由不正确的地址或SOAP操作引起。如果需要,请参阅InnerException 出席,了解更多详情 app.config文件如下所示,我想可能错误应该在下面的配置中 <client> <

我已经开发了窗口应用程序,我在特定的时间间隔调用WCF,但是通过WCF将数据插入数据库中没有错误,但在日志条目中,我得到了一个关于WCF端点的错误,如下所示

2011-22-09 10:16>>错误:没有端点侦听 可以接受消息的myserviceUrl(.svc)。这是经常发生的事 由不正确的地址或SOAP操作引起。如果需要,请参阅InnerException 出席,了解更多详情

app.config文件如下所示,我想可能错误应该在下面的配置中

<client>
      <endpoint address="myserviceUrl(.svc)"
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IApicaAzureMonitorAgentReceiverWCF"
        contract="Dashboard2WCFData.IApicaAzureMonitorAgentReceiverWCF"
        name="BasicHttpBinding_IApicaAzureMonitorAgentReceiverWCF" />
    </client>

下面是我的(WCF)服务的配置

<configuration>

  <configSections>
    <section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"/>
  </configSections>
  <dataConfiguration defaultDatabase="Connectionstr"/>
  <connectionStrings>
    <add name="Connectionstr" connectionString="myconnectionstring"/>   
  </connectionStrings>
  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>

</configuration>

请帮我解决这个问题


谢谢。

您需要在地址属性中指定整个虚拟路径
例如,您需要确保端点是在服务端配置的,而不仅仅是在客户端。换句话说,如果客户端使用myserviceUrl(.svc),则需要在服务的配置文件中指定地址

根据收到的错误消息,在服务的配置文件中尝试以下操作:

<endpoint address="myserviceUrl(.svc)"
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IApicaAzureMonitorAgentReceiverWCF"
    contract="Dashboard2WCFData.IApicaAzureMonitorAgentReceiverWCF"
    name="BasicHttpBinding_IApicaAzureMonitorAgentReceiverWCF" />

请注意,您需要确保您的服务具有名为“BasicHttpBinding_IApicaAzureMonitorAgentReceiverWCF”的适当绑定部分

如果您需要更全面的示例,请发布您的服务配置文件,我们将为您提供帮助

更新 如果将任何值设置为默认值以外的值,请添加端点节和绑定节:

<system.serviceModel>
<behaviors>
  <serviceBehaviors>
    <behavior>
    </behavior>
  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<services>
    <service name="myServiceName">
     <endpoint address="myserviceUrl(.svc)"
               binding="basicHttpBinding"
               bindingConfiguration="BasicHttpBinding_IApicaAzureMonitorAgentReceiverWCF"
               contract="Dashboard2WCFData.IApicaAzureMonitorAgentReceiverWCF"
               name="BasicHttpBinding_IApicaAzureMonitorAgentReceiverWCF"/>
     <endpoint name="mexHttpBinding"
               contract="IMetadataExchange"
               binding="mexHttpBinding"
               address="mex" />
  </service>
</services>
<bindings>
    <basicHttpBinding>
        <binding name="BasicHttpBinding_IApicaAzureMonitorAgentReceiverWCF" />
    </basicHttpBinding>
</bindings>


在我刚刚将其设置为私有的
中,假设将有完整的路径。错误似乎来自服务,而不是客户端。很可能Arun需要根据我下面的回答更新其服务的配置文件。我已在我的问题中发布了我的服务的配置文件,请检查它,但其中没有绑定部分…我已使用声明绑定和端点的示例(添加到您的服务配置中)更新了我的回答。