저는 Microsoft의 WF 4.5를 사용하고 있으며 거의 성공적으로 사용했습니다. 내부 웹 사이트 용으로 사용하고 있으므로 도메인 내에서 Windows 인증을 사용하고 있습니다. 그러나 나는 해결할 수 없다는 오류를 발견했습니다.sqlWorkflowInstanceStore를 사용할 때 WF 4.5에서 WindowsIdentity.Name을 가져 오는 데 문제가 발생했습니다.
web.config에서 sqlWorkflowInstanceStore를 활성화하려고 할 때마다 Workflow는 System.ServiceModel.ServiceSecurityContext.Current.WindowsIdentity.Name을 변수에 할당하려고 시도 할 때 예외를 throw합니다.
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)
다음은 내가 sqlWorkflowInstanceStore을 주석 경우, WindowsIdentity.Name 다시 잘 온다 (암호를 의도적으로 마스크 된)
<?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>
내 Web.config의입니다.
왜 그런가?