开发者

Error in Window application when it will call WCF

I have developed window application and in that i am calling WCF at particular time interval however there is no error in inserting data into database through WCF but in log entry i am getting one error regarding WCF Endpoint as per below

2011-22-09 10:16>>Error: There was no endpoint listening at myserviceUrl(.svc) that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

app.config file as per below and i guess that probably error should be in below configuration

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

Below is my (WCF)service's configuration..

<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&开发者_如何学Gogt;
  <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>

Please help me to sort out of this issues.

Thanks.


You need to make sure that the endpoint is configured at the service side, not just your client. In other words, if the client uses myserviceUrl(.svc), the address needs to be specified in the service's config file.

Based on the error message you got, try this in the service's config file:

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

Note that you'll need to ensure your service has the appropriate binding section named "BasicHttpBinding_IApicaAzureMonitorAgentReceiverWCF".

If you need a more thorough example, post your service's config file and we'll help you out.

UPDATE Add an endpoint section, and a binding section if you have any values set to other than the default values:

<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>

In the <binding name="" section is where you'd set the values for the binding. If you don't do this (and don't specify the section in the endpoint's bindingConfiguration attribute) WCF will use the default values for basicHttpBinding.

NOTE: With WCF 4.0 and later, you actually don't need to specify an endpoint (or create a .svc file if hosting under IIS), as WCF will supply a default endpoint based on the URI of the service. See A Developer's Introduction to Windows Communication Foundation 4 for details on this and other new features in 4.0.


You need to specify in address attribute the whole virtual path for example http://localhost/yousite/myservice.svc

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜