Could not find endpoint element with name and contract from configuration file

I have 3 projects in my solution. The first is an asp.net mvc project (as a client application), the other is a WCF service application , and the last is a workflow activity library . I added a link to the WCF service to link to the project workflow project and workflow added to asp.net mvc. When I used the wcf service in action and started the workflow from asp.net mvc, I get this error:

Could not find endpoint element named BasicHttpBinding_IService and contract IService in the client configuration of the ServiceModel section. Perhaps this is because the configuration file was not found by your application, or because no endpoint element matching this name can be found in the client element.

This is the contents of my app.config workflow library:

 <configuration> <system.serviceModel> <bindings> <basicHttpBinding> <binding name="BasicHttpBinding_IService1" /> </basicHttpBinding> </bindings> <client> <endpoint address="http://localhost:30717/Service1.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService1" contract="Service1.IService1" name="BasicHttpBinding_IService1" /> </client> </system.serviceModel> </configuration> 

And this is my wcf project web.config file:

 <configuration> <appSettings> <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" /> </appSettings> <system.web> <compilation debug="true" targetFramework="4.5" /> <httpRuntime targetFramework="4.5"/> </system.web> <system.serviceModel> <behaviors> <serviceBehaviors> <behavior> <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/> <serviceDebug includeExceptionDetailInFaults="false"/> </behavior> </serviceBehaviors> </behaviors> <protocolMapping> <add binding="basicHttpBinding" scheme="http" /> </protocolMapping> <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /> </system.serviceModel> <system.webServer> <modules runAllManagedModulesForAllRequests="true"/> <directoryBrowse enabled="true"/> </system.webServer> </configuration> 

And this is my contents of asp.net mvc web.config file:

 <configuration> <appSettings> <add key="webpages:Version" value="3.0.0.0"/> <add key="webpages:Enabled" value="false"/> <add key="ClientValidationEnabled" value="true"/> <add key="UnobtrusiveJavaScriptEnabled" value="true"/> </appSettings> <system.web> <compilation debug="true" targetFramework="4.5"/> <httpRuntime targetFramework="4.5"/> </system.web> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35"/> <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35"/> <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/> <bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0"/> </dependentAssembly> </assemblyBinding> </runtime> <system.serviceModel> <bindings> <basicHttpBinding> <binding name="BasicHttpBinding_IService1" /> </basicHttpBinding> </bindings> <client> <endpoint address="http://localhost:30717/Service1.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService1" contract="ServiceTest.IService1" name="BasicHttpBinding_IService1" /> </client> </system.serviceModel> </configuration> 

And this is my code to start the workflow in asp.net mpc controller:

 wf.Activity1 mm = new wf.Activity1();//wf is reference added from workflow project mm.arg1 = "12".ToString() ; IDictionary<string, object> res = WorkflowInvoker.Invoke(mm); ViewBag.res = res["arg2"].ToString(); 

I figured out during the day and, unfortunately, did not get the result. Thanks for your guidance.

Edit: This is my project for additional help.

+7
wcf wcf-binding workflow-activity
source share
2 answers

Remove "1" from the attributes of the contract and name in the workflow configuration file.

The BasicHttpBinding_IService class generated by VS, when instantiating, it looks for a configuration for some suitable endpoint that meets two conditions:

  • has a class name (BasicHttpBinding_IService, if nothing is passed to the constructor). The namespace must also be specified. In this case, the endpoint name should be .BasicHttpBinding_IService
  • has a contract supported by the class.

To prevent further error, you should check the svc file name, the name ends with '1'. The binding configuration is fine because it exists in the binding section with exactly the same name.

Here's a simplified configuration option:

 <configuration> <system.serviceModel> <client> <endpoint address="http://localhost:30717/Service.svc" binding="basicHttpBinding" contract="Service1.Service" name="<namespace>.BasicHttpBinding_IService" /> </client> </system.serviceModel> 

You can also use the Visual Studio WFC Service configuration tool (shortcut in the tool menu), edit the configuration files of both clients and services.

+4
source share

the error message is correct enough: you do not have the service endpoints configured in your WCF Web.config services

add node services and configure the endpoint as follows:

  .... <system.serviceModel> <services> <service name="MyService"> <endpoint address="" binding="basicHttpBinding" contract="Service1.IService1" /> </service> </services> <behaviors> .... 
+1
source share

All Articles