powered by simpleCommunicator - 2.0.40     © 2025 Programmizd 02
Форумы / WCF, Web Services, Remoting [игнор отключен] [закрыт для гостей] / WCF service ошибка Memory gates checking failed because the free memory
2 сообщений из 2, страница 1 из 1
WCF service ошибка Memory gates checking failed because the free memory
    #38166978
Фотография yardie
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Здравствуйте! Делаю большое web приложение(сайт) на Silverlight. В качестве сервиса для доспупа данных использую обычный WCF service(.svc). C БД работаю при помощи обычного DateReader.

Проблема в том, что после загрузке портала на хостинг через минут 40-60 данные на сайт перестают поступать и сервис выдаёт такую ошибку:
Код: xml
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
 Memory gates checking failed because the free memory (485363712 bytes) is less than 5% of total memory.  As a result, the service will not be available for incoming requests.  To resolve this, either reduce the load on the machine or adjust the value of minFreeMemoryPercentageToActivateService on the serviceHostingEnvironment config element.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InsufficientMemoryException: Memory gates checking failed because the free memory (485363712 bytes) is less than 5% of total memory.  As a result, the service will not be available for incoming requests.  To resolve this, either reduce the load on the machine or adjust the value of minFreeMemoryPercentageToActivateService on the serviceHostingEnvironment config element.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[InsufficientMemoryException: Memory gates checking failed because the free memory (485363712 bytes) is less than 5% of total memory.  As a result, the service will not be available for incoming requests.  To resolve this, either reduce the load on the machine or adjust the value of minFreeMemoryPercentageToActivateService on the serviceHostingEnvironment config element.]
   System.ServiceModel.Activation.ServiceMemoryGates.Check(Int32 minFreeMemoryPercentage, Boolean throwOnLowMemory, UInt64& availableMemoryBytes) +58980
   System.ServiceModel.HostingManager.CheckMemoryCloseIdleServices(EventTraceActivity eventTraceActivity) +95
   System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity) +584

[ServiceActivationException: The service '/MainService.svc' cannot be activated due to an exception during compilation.  The exception message is: Memory gates checking failed because the free memory (485363712 bytes) is less than 5% of total memory.  As a result, the service will not be available for incoming requests.  To resolve this, either reduce the load on the machine or adjust the value of minFreeMemoryPercentageToActivateService on the serviceHostingEnvironment config element..]
   System.Runtime.AsyncResult.End(IAsyncResult result) +495736
   System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +178
   System.ServiceModel.Activation.ServiceHttpModule.EndProcessRequest(IAsyncResult ar) +348782
   System.Web.AsyncEventExecutionStep.OnAsyncEventCompletion(IAsyncResult ar) +9663393



Я понимаю что где-то идёт утечка памяти, подскажите как избавиться от этой проблеммы?

методы которые я использую для работы с БД в сервисе выглядят вот так:

Код: c#
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
public List<GetAllUser> GetAllUsers(int id)
        {
            using (SqlConnection sqConn = new SqlConnection(ConfigurationManager.ConnectionStrings["VSMconnection"].ConnectionString))
            {
                List<GetAllUser> Data = new List<GetAllUser>();
                sqConn.Open();
                SqlCommand cmd = new SqlCommand();
                cmd.Connection = sqConn;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "[Web].[GetAllPersons]";
                cmd.Parameters.AddWithValue("@Id", id);
                SqlDataReader sdr = null;
                sdr = cmd.ExecuteReader();

                while (sdr.Read())
                {
                    var GetData = new GetAllUser
                    {
                        UserLog = sdr["Email"].ToString(),
                        UserAllName = sdr["Name"].ToString()
                    };
                    Data.Add(GetData);
                }
                sdr.Close();
                sqConn.Close();
                return Data;
            } 
...
Рейтинг: 0 / 0
Период между сообщениями больше года.
WCF service ошибка Memory gates checking failed because the free memory
    #39147007
drLivsi_
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
yardie,

Для WCF в веб-конфиге можно выставить
Код: c#
1.
2.
3.
<system.serviceModel> 
    <serviceHostingEnvironment minFreeMemoryPercentageToActivateService="0" />
</system.serviceModel> 


Сервис будет падать чуть позже, но это скорее всего не решит вашей проблемы.
...
Рейтинг: 0 / 0
2 сообщений из 2, страница 1 из 1
Форумы / WCF, Web Services, Remoting [игнор отключен] [закрыт для гостей] / WCF service ошибка Memory gates checking failed because the free memory
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]