2013-07-30 2 views
0

Я использую Microsoft WF 4.5 и в значительной степени успешно справился с этим. Я использую его для внутреннего веб-сайта и, следовательно, использую проверку подлинности Windows в нашем домене. Однако я столкнулся с ошибкой, что я не могу решить проблему.Проблема с получением WindowsIdentity.Name внутри WF 4.5 при использовании sqlWorkflowInstanceStore

Всякий раз, когда я пытаюсь включить sqlWorkflowInstanceStore в web.config, Workflow генерирует исключение, когда он пытается присвоить переменной 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 возвращается в порядке.

Любые идеи, почему?

ответ

0

В рабочем потоке 4.0 и, возможно, 4.5, контекст не раскрывает OperationContext и, следовательно, ServiceSecurityContext.

Если у вас есть альтернативное решение, сообщите мне об этом.

Смежные вопросы