有时将WCF应用程序部署到Azure App Service时会发生此错误。在发生此错误的同时,我们也有成功的请求;例如,在一分钟内,我们可能有30个请求,其中2个因此错误而失败,而28个通过而没有任何问题。
你知道为什么会这样吗?
Exception information:
Exception type: System.Configuration.ConfigurationErrorsException
Exception message: Thread was being aborted. (path\web.config line 81)
Inner exception information (level 1):
Exception type: System.Configuration.ConfigurationErrorsException
Exception message: Thread was being aborted.
Inner exception information (level 2):
Exception type: System.Threading.ThreadAbortException
Exception message: Thread was being aborted.
Request information:
Request URL: someService.svc/Compress
Request path: someService.svc/Compress
User host address: 23.101.165.181
User:
Is authenticated: False
Authentication Type:
Thread account name: IIS APPPOOL\webapp__707e
Thread information:
Thread ID: 57
Thread account name: IIS APPPOOL\webapp__707e
Is impersonating: False
Stack trace: at System.Web.Security.Roles.Initialize()
at System.Web.Security.RoleManagerModule.OnEnter(Object source, EventArgs eventArgs)
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
web.config
中的第81行是以下块中的<add />
元素:
<roleManager enabled="true" cacheRolesInCookie="false" defaultProvider="SqlProvider">
<providers>
<clear />
<add applicationName="BMS.net" name="SqlProvider" type="Ayuda.CloudManager.Providers.CloudManagerSqlRoleProvider" />
</providers>
</roleManager>
<system.serviceModel>
<extensions>
<bindingElementExtensions>
<add name="gzipMessageEncoding" type="Microsoft.ServiceModel.Samples.GZipMessageEncodingElement, GZipEncoder, Version=1.0.0.0, Culture=neutral, PublicKeyToken=dd38b054e1e8815c" />
</bindingElementExtensions>
</extensions>
<behaviors>
<serviceBehaviors>
<behavior name="RequestProcessorBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
<serviceThrottling maxConcurrentCalls="500" maxConcurrentInstances="500" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="RequestProcessorBehavior" name="Agatha.ServiceLayer.WCF.WcfRequestProcessor">
<endpoint address="" binding="customBinding" bindingConfiguration="HttpsTransport_BinaryMessageEncoding" contract="Agatha.Common.WCF.IWcfRequestProcessor" />
<endpoint address="Compress" binding="customBinding" bindingConfiguration="HttpsTransport_BinaryMessageEncoding_Compress" contract="Agatha.Common.WCF.IWcfRequestProcessor" />
</service>
</services>
<bindings>
<customBinding>
<binding name="HttpsTransport_BinaryMessageEncoding">
<binaryMessageEncoding>
<readerQuotas maxArrayLength="262144" maxBytesPerRead="4096" maxStringContentLength="262144" />
</binaryMessageEncoding>
<httpTransport maxReceivedMessageSize="4194304" />
</binding>
<binding name="HttpsTransport_BinaryMessageEncoding_Compress">
<gzipMessageEncoding innerMessageEncoding="binaryMessageEncoding">
<readerQuotas maxArrayLength="262144" maxBytesPerRead="4096" maxStringContentLength="262144" />
</gzipMessageEncoding>
<httpTransport maxReceivedMessageSize="4194304" />
</binding>
</customBinding>
</bindings>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" />
</system.serviceModel>
<location path="someService.svc">
<system.web>
<authorization>
<allow users="?" />
</authorization>
</system.web>
</location>