2

我有一个 Web.API 站点,它与在 AppFabric/IIS 8.0 - Server 2012 中托管的本地 WCF WF 服务通信

MVC 控制器具有对本地 .xamlx 服务的服务引用

这是服务配置的 ServiceModel 部分:

<system.serviceModel>
<bindings>
  <netNamedPipeBinding>
    <binding name="NetNamedPipeBinding.IVoiceService" maxBufferSize="65536" maxConnections="100">
      <security mode="None" />
    </binding>
  </netNamedPipeBinding>
</bindings>
<client>
  <endpoint address="net.pipe://localhost/Main.xamlx" binding="netNamedPipeBinding"
    bindingConfiguration="NetNamedPipeBinding_.IVoiceService"
    contract="Voice.IVoiceService" name="NetNamedPipeBinding.IVoiceService" />
</client>

WCF WF 服务模型部分:

  <system.serviceModel>
<bindings>
 <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" 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 behaviorConfiguration="MEX" name="Main">
    <endpoint address="MEX" binding="mexHttpBinding" contract="IMetadataExchange" />
    <endpoint address="MEX" binding="mexTcpBinding" contract="IMetadataExchange" />
    <endpoint address="" binding="netNamedPipeBinding" bindingConfiguration="pipeSecurityOff" contract="NYRA.IVoiceService" />
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="MEX">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
      <sqlWorkflowInstanceStore instanceCompletionAction="DeleteAll" instanceEncodingOption="None" instanceLockedExceptionAction="NoRetry" connectionStringName="ApplicationServerWorkflowInstanceStoreConnectionString" hostLockRenewalPeriod="00:00:30" runnableInstancesDetectionPeriod="00:00:05" />
      <workflowInstanceManagement authorizedWindowsGroup="AS_Administrators" />
      <workflowUnhandledException action="AbandonAndSuspend" />
      <workflowIdle timeToPersist="00:00:00" timeToUnload="00:00:00" />
      <etwTracking profileName="Troubleshooting Tracking Profile" />
      <serviceThrottling maxConcurrentCalls="256" maxConcurrentSessions="800" maxConcurrentInstances="928" />
    </behavior>
  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true">
</serviceHostingEnvironment>

因此,如果您注意到绑定中缺少 MaxConnections 属性:

<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" maxReceivedMessageSize="65536">

如果我打开 IIS 8.0 并编辑端点,转到性能选项卡并将最大连接数从 10 更改为 100。它会更新 web.config:

<binding transactionFlow="false" maxBufferSize="65536" maxConnections="100" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" hostNameComparisonMode="StrongWildcard" transactionProtocol="OleTransactions" transferMode="Buffered" name="pipeSecurityOff" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00">

现在我得到一个错误:

此错误(HTTP 500 Internal Server Error)表示您访问的网站存在服务器问题,导致网页无法显示。

日志显示:

<Message>There is no compatible TransportManager found for URI 'net.pipe://myuritemp/Main.xamlx/System.ServiceModel.Activities_IWorkflowInstanceManagement'. This may be because you have used an absolute address that points outside of the virtual application, or the binding settings of the endpoint do not match those that have been set by other services or endpoints. Note that all bindings for the same protocol should have the same settings in the same application.</Message>

看来您应该能够更改此属性:http: //msdn.microsoft.com/en-us/library/system.servicemodel.netnamedpipebinding.maxconnections.aspx

为什么将此属性添加到绑定会使服务器崩溃?如何增加命名管道连接以获得更好的性能?

4

0 回答 0