【发布时间】:2017-01-04 17:58:52
【问题描述】:
我的解决方案中有 3 个项目。第一个项目是asp.net mvc(作为客户端应用程序),另一个是WCF service application,最后一个是workflow activity library。我将 WCF 服务引用添加到工作流项目,并将工作流项目引用添加到 asp.net mvc。当我在活动中使用 wcf 服务并从 asp.net mvc 启动工作流时,我收到此错误:
找不到名为 BasicHttpBinding_IService 的端点元素 并在 ServiceModel 客户端配置中签约 IService 部分。这可能是因为找不到配置文件 您的应用程序,或者因为没有匹配此名称的端点元素 可以在客户端元素中找到。
这是我的工作流活动库app.config 文件内容:
<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>
这是我的 wcf 项目 web.config 文件内容:
<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>
这是我的asp.net mvc web.config文件内容:
<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>
这是我在 asp.net mvc 控制器中运行工作流的代码:
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();
我用谷歌搜索了一天,不幸的是我没有得到结果。感谢您的指导。
编辑: This 是我寻求更多帮助的项目。
【问题讨论】:
标签: wcf wcf-binding workflow-activity