Проблема с получением WindowsIdentity.Name внутри WF 4.5 при использовании sqlWorkflowInstanceStore

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

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

Есть идеи, почему?


person maggic    schedule 30.07.2013    source источник


Ответы (1)


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

Если у вас есть альтернативное решение, дайте мне знать

person Rupam Roy    schedule 09.01.2014