我想在 wf4.0 中使用企业库验证。下面是我的配置。
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<services>
<service name="Service1" behaviorConfiguration="PublishMetadata">
<endpoint address=""
binding="basicHttpBinding" contract="ITestService" behaviorConfiguration="Validation"/>
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="Validation">
<validation enabled="true"/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="PublishMetadata">
<serviceMetadata httpGetEnabled="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<extensions>
<behaviorExtensions>
<add name="validation"
type="Microsoft.Practices.EnterpriseLibrary.Validation.Integration.WCF.ValidationElement, Microsoft.Practices.EnterpriseLibrary.Validation.Integration.WCF, Version=4.1.0.0, Culture=neutral, PublicKeyToken=null" />
</behaviorExtensions>
</extensions>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
当我尝试在网络浏览器中浏览服务时抛出异常。例外 :-
“/”应用程序中的服务器错误。
值不能为空。参数名称:operation.SyncMethod 描述:当前Web请求执行过程中发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。
异常详细信息:System.ArgumentNullException:值不能为空。参数名称:操作.SyncMethod