1

標準の名前付きパイプ エンドポイントを介して AppFabric でホストされているワークフロー サービスを管理しようとしています。コンソール アプリケーションからこれを実行できますが、ASP.NET から同じことを実行しようとすると、「アクセスが拒否されました」という例外が発生します。

web.configで何らかの方法で解決する必要があるのはセキュリティ構成の問題であることは理解していますが、方法がわかりません...

私が使用するコードは次のとおりです。

NetNamedPipeBinding binding = new NetNamedPipeBinding();
EndpointAddress addr = new EndpointAddress("net.pipe://localhost/ServiceLibrary/LongRunningService.xamlx/System.ServiceModel.Activities_IWorkflowInstanceManagement");

try
{
    var proxy = new WorkflowControlClient(binding, addr);
    Guid instanceId = new Guid("<<SOME WORKFLOW INSTANCE ID>>");
    proxy.Suspend(instanceId);
}
catch (Exception ex)
{
}

更新: 理論的には、セキュリティなしで web.config にエンドポイント (http または net.pipe) を登録することは可能です。この場合、すべてが機能しているように見えます...しかし、サイトに登録されているすべてのサービスに対してこれを実行したくありません。既に登録されている net.pipe エンドポイントに接続する方法が必要だと思います。明示的なエンドポイント登録 (http、net.pipe) を使用した Web 構成は次のとおりです。

<behaviors>
  <serviceBehaviors>
    <behavior>
      <remove name="serviceCredentials" />
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="false" />
      <sqlWorkflowInstanceStore instanceCompletionAction="DeleteNothing" instanceEncodingOption="None" instanceLockedExceptionAction="NoRetry" connectionStringName="ApplicationServerWorkflowInstanceStoreConnectionString" hostLockRenewalPeriod="00:00:30" runnableInstancesDetectionPeriod="00:00:05" />
      <workflowInstanceManagement authorizedWindowsGroup="" />
      <workflowUnhandledException action="AbandonAndSuspend" />
      <workflowIdle timeToPersist="00:00:30" timeToUnload="00:01:00" />
      <etwTracking profileName="Troubleshooting Tracking Profile" />
    </behavior>
    <behavior name="StnandardBehavior">
      <remove name="serviceCredentials" />
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="false" />
      <sqlWorkflowInstanceStore instanceCompletionAction="DeleteNothing" instanceEncodingOption="None" instanceLockedExceptionAction="NoRetry" connectionStringName="ApplicationServerWorkflowInstanceStoreConnectionString" hostLockRenewalPeriod="00:00:30" runnableInstancesDetectionPeriod="00:00:05" />
      <workflowInstanceManagement authorizedWindowsGroup="" />
      <workflowUnhandledException action="AbandonAndSuspend" />
      <workflowIdle timeToPersist="00:00:30" timeToUnload="00:01:00" />
      <etwTracking profileName="Troubleshooting Tracking Profile" />
    </behavior>
  </serviceBehaviors>
</behaviors>
<bindings>
  <basicHttpBinding>
    <binding name="httpSecurityOff" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
      <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
      <security mode="None">
        <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
        <message clientCredentialType="UserName" algorithmSuite="Default" />
      </security>
    </binding>
  </basicHttpBinding>
  <netNamedPipeBinding>
    <binding name="pipeSecurityOff" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" maxConnections="10" maxReceivedMessageSize="65536">
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
      <security mode="None">
        <transport protectionLevel="None" />
      </security>
    </binding>
  </netNamedPipeBinding>
</bindings>
<services>
  <service name="LongRunningService" behaviorConfiguration="StnandardBehavior">
    <endpoint address="wce" contract="System.ServiceModel.Activities.IWorkflowInstanceManagement" binding="basicHttpBinding" bindingConfiguration="httpSecurityOff" kind="workflowControlEndpoint" />
    <endpoint address="wce" contract="System.ServiceModel.Activities.IWorkflowInstanceManagement" binding="netNamedPipeBinding" bindingConfiguration="pipeSecurityOff" kind="workflowControlEndpoint" />
    <endpoint contract="ILongRunningService" binding="basicHttpBinding" bindingConfiguration="httpSecurityOff" />
  </service>
</services>

この場合、この新しいエンドポイントに接続するためのクライアント コードは、少し異なる必要があります。

    NetNamedPipeBinding binding = new NetNamedPipeBinding();
    binding.Security.Mode = NetNamedPipeSecurityMode.None;
    EndpointAddress addr = new EndpointAddress("net.pipe://{{MACHINE_NAME}}/ServiceLibrary/LongRunningService.xamlx/wce");

    try
    {
        var proxy = new WorkflowControlClient(binding, addr);
        Guid instanceId = new Guid(workflowInstanceId.Value);
        proxy.Suspend(instanceId);
        proxy.Close();
    }
    catch (Exception ex)
    {
    }
4

3 に答える 3

1

セキュリティをオフにして、ASP.NETアプリプールIDACLに問題があるかどうかを確認できます。

NetNamedPipeBinding nnpb = new NetNamedPipeBinding();
nnpb.Security.Mode = NetNamedPipeSecurityMode.None;
于 2012-04-20T07:05:18.150 に答える
0

ワークフローApplicationPoolユーザーをユーザーグループ「AS_Administrators」に入れてみてください。セキュリティの変更を再ロードするには、IISのリセットが必要です。

于 2012-11-25T22:23:46.137 に答える
0

IISでアプリケーションに許可されているWebサイト/仮想ディレクトリのバインドを編集しましたか?許可されたプロトコルバインディングとしてnet.pipeを追加する必要があります。

于 2012-04-19T20:50:31.890 に答える