![](/img/trans.png)
[英]The type or namespace name 'SqlWorkflowInstanceStore'
[英]Issue retrieving WindowsIdentity.Name inside WF 4.5 when using sqlWorkflowInstanceStore
我正在使用Microsoft的WF 4.5,並且在很大程度上取得了成功。 我將其用於內部網站,因此在我們的域內使用Windows身份驗證。 我偶然發現了一個錯誤,但是我無法解決。
每當我嘗試在web.config中啟用sqlWorkflowInstanceStore時,工作流在嘗試將System.ServiceModel.ServiceSecurityContext.Current.WindowsIdentity.Name分配給變量時都會引發異常。
Object reference not set to an instance of an object.
Server stack trace:
at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at IService.SubmitWorkHours(Int32[]& p_workHours)
at ServiceClient.SubmitWorkHours(Int32[]& p_workHours)
以下是我的web.config(密碼被故意屏蔽)
<?xml version="1.0"?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService" sendTimeout="00:05:00">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="Service1" behaviorConfiguration="WindowsAuthenticationBehavior">
<endpoint address="http://localhost/SimpleTimesheetService/TimesheetApproval.xamlx" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IService" contract="IService" name="BasicHttpBinding_IService"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="WindowsAuthenticationBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<serviceCredentials>
<windowsAuthentication includeWindowsGroups="true" allowAnonymousLogons="false"/>
</serviceCredentials>
<serviceAuthorization principalPermissionMode="UseWindowsGroups" />
<sqlWorkflowInstanceStore instanceCompletionAction="DeleteAll" instanceEncodingOption="GZip" instanceLockedExceptionAction="NoRetry" connectionString="server=D801903;database=AppFabPersist;PWD=*******;UID=sa;" hostLockRenewalPeriod="00:00:30" runnableInstancesDetectionPeriod="00:00:05" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<system.web>
<authentication mode="Windows" />
<compilation debug="true"/>
</system.web>
</configuration>
如果我注釋掉sqlWorkflowInstanceStore,則WindowsIdentity.Name會恢復正常。
有什么想法嗎?
在工作流4.0和4.5中,上下文不會公開OperationContext,因此不會公開ServiceSecurityContext。
如果您有其他解決方案,請告訴我
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.