1

We have an azure cloud service with a WCF installed as web role. The service connects to an azure db online using entity framework. The service is consumed by a WPF Client which use a corporate proxy to connect to the web.

Sometimes the client receive the error: " Server is too busy." , and the inner exception is "HTTP 503 - Service Unavailable".

To investigate this error i tried to connect on the cloud service's VM through remote desktop:

  1. Event Viewer:No sign of application pool crash or errors both in "Application" and in "System" sections.
  2. FREB Logs(with rule activated): Nothing logged.
  3. HTTPerr log:No Trace of the failed requests.
  4. I have activated WCF internal TraceLog. The log correctly trace information but there aren't exceptions or errors logged.

On IIS i have changed:

  • Application pool from "ondemand" to "always running"
  • Queue limit
  • Disabled rapid fail protection ( just for test)
  • Changed Application pool identity

I also added Telemetry to WCF to log all Exception and some trace of requests. Nothing has helped, the error continue to appears randomly.

Today i have installed WireShark on the server hosting the WCF and captured inbound traffic. Even there no sign of failed requests with response code != 200, all the requests are "http1.1 200 OK."

Some days ago i worked from home and used the WPF Client a lot(without using the proxy) and the error never showed up.

Could be related to the corporate proxy we use at work ?

Below the client and WCF Configs:

WPF client config:

 <?xml version="1.0" encoding="utf-8"?>
<configuration>
    <configSections>
  </configSections>

  <appSettings>
    <add key="ClientSettingsProvider.ServiceUri" value="" />
  </appSettings>
  </connectionStrings>
  </entityFramework>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
  </startup>
  <system.serviceModel>
    <bindings>
      <customBinding>
        <binding name="largedata"  closeTimeout="00:21:00" openTimeout="00:20:00" receiveTimeout="00:20:00" sendTimeout="00:20:00">
          <security  authenticationMode="UserNameOverTransport" messageSecurityVersion="WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10" allowInsecureTransport="true" />
          <binaryMessageEncoding  maxReadPoolSize="2147483647" maxWritePoolSize="2147483647" compressionFormat="GZip">
            <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          </binaryMessageEncoding>
          <httpTransport  bypassProxyOnLocal="True"
                          authenticationScheme="Basic"
                          useDefaultWebProxy="True" 
                          proxyAuthenticationScheme="Basic" 
                          keepAliveEnabled="True" 
                          maxBufferPoolSize="2147483647"
                          maxReceivedMessageSize="2147483647"
                          maxBufferSize="2147483647" />
        </binding>
      </customBinding>
    </bindings>
    <client>
      <endpoint address="http://wcfadress/Data.svc" binding="customBinding" bindingConfiguration="largedata" contract="DataService.DataService" name="largedata" />
    </client>                       
  </system.serviceModel>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.6.4.0" newVersion="5.6.4.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Data.Services.Client" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.6.4.0" newVersion="5.6.4.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.6.4.0" newVersion="5.6.4.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <system.net>
    <defaultProxy enabled="true" useDefaultCredentials="true">
      <proxy proxyaddress="http://proxyadress" ></proxy>
    </defaultProxy>
        <settings>
      <servicePointManager expect100Continue="false" />
    </settings>
  </system.net>
  <system.web>
    <membership defaultProvider="ClientAuthenticationMembershipProvider">
      <providers>
        <add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
      </providers>
    </membership>
    <roleManager defaultProvider="ClientRoleProvider" enabled="true">
      <providers>
        <add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
      </providers>
    </roleManager>
  </system.web>
</configuration>

WCF Config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
<system.diagnostics>
    <trace>
        <listeners>
            <add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=2.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="AzureDiagnostics">
                <filter type="" />
            </add>
        </listeners>
    </trace>
  <sources>
      <source name="System.ServiceModel" switchValue="Critical, Error, Warning" propagateActivity="true">
        <listeners>
          <add name="traceListener" type="System.Diagnostics.XmlWriterTraceListener" initializeData="c:\temp\TracesWCF.svclog" />
        </listeners>
      </source>
    </sources>
</system.diagnostics>
<connectionStrings>
  <add name="Clio" providerName="System.Data.EntityClient" connectionString="metadata=res://*/DataMadel.csdl|res://*/DataMadel.ssdl|res://*/DataMadel.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=*****;Initial Catalog=*****;Language=Italian;Integrated Security=False;*****;Password=*****;Connection Timeout=600;MultipleActiveResultSets=True;Encrypt=True;Min Pool Size=20;Max Pool Size=50;TrustServerCertificate=False&quot;" />
  </connectionStrings>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
  </entityFramework>
  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  <system.web>
   <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" maxRequestLength="202400" />
    <httpModules>
      <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Extensibility.Web.RequestTracking.WebRequestTrackingModule, Microsoft.ApplicationInsights.Extensibility.Web" />
    </httpModules>
  </system.web>
  <system.serviceModel>
     <diagnostics>
      <messageLogging
              logEntireMessage="true"
              logMalformedMessages="false"
              logMessagesAtServiceLevel="true"
              logMessagesAtTransportLevel="true"
              maxMessagesToLog="400"
              maxSizeOfMessageToLog="6000"/>
    </diagnostics>
    <bindings>
       <customBinding>
        <binding name="largedata" closeTimeout="00:21:00" openTimeout="00:20:00" receiveTimeout="00:20:00" sendTimeout="00:50:00">
             <security authenticationMode="UserNameOverTransport" messageSecurityVersion="WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10" allowInsecureTransport="true" />
          <binaryMessageEncoding maxReadPoolSize="2147483647" maxWritePoolSize="2147483647" compressionFormat="GZip">
            <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          </binaryMessageEncoding>
          <httpTransport maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
        </binding>
      </customBinding>
    </bindings>
    <services>
      <service name="ArchivioStorico.Service.DataService" behaviorConfiguration="Auth">
        <endpoint address="" binding="customBinding" bindingConfiguration="largedata" contract="ArchivioStorico.Service.DataService" />
        <endpoint address="basicHttp" binding="basicHttpBinding" contract="ArchivioStorico.Service.DataService" />
      </service>
     </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="Auth">
          <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="true" />
          <dataContractSerializer maxItemsInObjectGraph="2147483647" />
          <serviceThrottling maxConcurrentCalls="1300" maxConcurrentSessions="1300" maxConcurrentInstances="1300"></serviceThrottling>
          <serviceCredentials>
            <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="ArchivioStorico.Service.CustomValidator.CustomUserNameValidator, App_Code" />
          </serviceCredentials>
        </behavior>   

       </serviceBehaviors>
      <endpointBehaviors>
        <behavior>
          <dataContractSerializer maxItemsInObjectGraph="2147483647" />
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <protocolMapping>
      <add binding="basicHttpsBinding" scheme="https" />
      <add binding="basicHttpBinding" scheme="http" />
      <add binding="webHttpBinding" scheme="http" />
    </protocolMapping>    
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true">
      <remove name="ApplicationInsightsWebTracking" />
      <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Extensibility.Web.RequestTracking.WebRequestTrackingModule, Microsoft.ApplicationInsights.Extensibility.Web" preCondition="managedHandler" />
    </modules>
    <!--
        To browse web app root directory during debugging, set the value below to true.
        Set to false before deployment to avoid disclosing web app folder information.
      -->
    <directoryBrowse enabled="true" />
    <security>
      <requestFiltering>
        <!--Increase 'maxAllowedContentLength' to needed value: 100mb (value is in bytes)-->
        <requestLimits maxAllowedContentLength="204857600" />
      </requestFiltering>
    </security>
    <validation validateIntegratedModeConfiguration="false" />
  </system.webServer>

  <runtime>

    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

      <dependentAssembly>

        <assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral" />

        <bindingRedirect oldVersion="0.0.0.0-5.6.4.0" newVersion="5.6.4.0" />

      </dependentAssembly>

      <dependentAssembly>

        <assemblyIdentity name="Microsoft.Data.Services.Client" publicKeyToken="31bf3856ad364e35" culture="neutral" />

        <bindingRedirect oldVersion="0.0.0.0-5.6.4.0" newVersion="5.6.4.0" />

      </dependentAssembly>

      <dependentAssembly>

        <assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31bf3856ad364e35" culture="neutral" />

        <bindingRedirect oldVersion="0.0.0.0-5.6.4.0" newVersion="5.6.4.0" />

      </dependentAssembly>

    </assemblyBinding>

  </runtime>
  <system.net>
    <settings>
      <servicePointManager expect100Continue="false" />
    </settings>
  </system.net>
</configuration>
Ramius
  • 11
  • 3

0 Answers0