Entity Framework数据库上下文中的内存泄漏

时间:2014-07-07 17:32:18

标签: c# entity-framework memory-leaks entity-framework-6 dbcontext

我试图找出这个问题3天我在互联网上进行了大量的Google搜索并使用了个人资料分析器(dotmemory 4.0)。

我使用Castle Windsor作为依赖注入库和实体框架6代码的第一个模型。 大多数模型取自prodinner示例应用程序(prodinner),我做了一些修改。

我将在我的数据层中编写代码。我专注于数据层导致当被调用页面中的数据增加内存泄漏变得巨大时。我可以通过配置文件分析器跟踪它。

-------------- DbContextFactory类--------------------

     public interface IDbContextFactory:IDisposable
{
    DbContext GetContext();
}

public class DbContextFactory : IDbContextFactory
{
    private readonly DbContext dbContext;
    public DbContextFactory()
    {
        dbContext = new Db();
    }

    public DbContext GetContext()
    {
        return dbContext;
    }

    #region IDisposable

    public void Dispose()
    {
        Dispose(true);
        GC.SuppressFinalize(this);
    }

    protected virtual void Dispose(bool disposing)
    {
        if (disposing)
        {
            if (dbContext != null)
            {   
                dbContext.Dispose();
            }
        }
    }

    #endregion  
}

--------------------- Db Class ------------------------ -----

    public class Db : DbContext
{
    public Db()
    {
        Database.SetInitializer<Db>(new MigrateDatabaseToLatestVersion<MediaManagerV2.Data.Db,Configuration>());
    }
    public DbSet<Effect> Effects { get; set; }
    public DbSet<Feed> Feeds { get; set; }
    public DbSet<File> Files { get; set; }
    public DbSet<FileExtension> FileExtensions { get; set; }
    public DbSet<Folder> Folders { get; set; }
    public DbSet<Layer> Layers { get; set; }
    public DbSet<RepeatSetting> RepeatSettings { get; set; }
    public DbSet<RepeatSettingsWeekDay> RepeatSettingsWeekDays { get; set; }
    public DbSet<Role> Roles { get; set; }
    public DbSet<Notification> Notifications { get; set; }
    public DbSet<Schedule> Schedules { get; set; }
    public DbSet<ScheduleFile> ScheduleFiles { get; set; }
    public DbSet<ScheduleLayer> ScheduleLayers { get; set; }
    public DbSet<SchedulePosition> SchedulePositions { get; set; }
    public DbSet<SchedulePlayList> SchedulePlayLists { get; set; }
    public DbSet<SchedulePlayListFile> SchedulePlayListFiles { get; set; }
    public DbSet<ScheduleScreen> ScheduleScreens { get; set; }
    public DbSet<ScheduleSetting> ScheduleSettings { get; set; }
    public DbSet<Screen> Screens { get; set; }
    public DbSet<ScreenCommandConsole> ScreenCommandConsoles { get; set; }
    public DbSet<ScreenCommandMagicInfo> ScreenCommandMagicInfoes { get; set; }
    public DbSet<ScreenGroup> ScreenGroups { get; set; }
    public DbSet<Setting> Settings { get; set; }
    public DbSet<SubFile> SubFiles { get; set; }
    public DbSet<Template> Templates { get; set; }
    public DbSet<User> Users { get; set; }
    public DbSet<UserRole> UserRoles { get; set; }
    public DbSet<UserNotification> UserNotifications { get; set; }
    public DbSet<SchemaContent> SchemaXmls { get; set; }

    protected override void OnModelCreating(DbModelBuilder modelBuilder)
    {
        modelBuilder.Conventions.Remove<ManyToManyCascadeDeleteConvention>();
        modelBuilder.Conventions.Remove<OneToManyCascadeDeleteConvention>();

        modelBuilder.Configurations.Add(new FeedMap());
        modelBuilder.Configurations.Add(new FileMap());
        modelBuilder.Configurations.Add(new FileExtensionMap());
        modelBuilder.Configurations.Add(new FolderMap());
        modelBuilder.Configurations.Add(new LayerMap());
        modelBuilder.Configurations.Add(new RepeatSettingMap());
        modelBuilder.Configurations.Add(new RepeatSettingsWeekDayMap());
        modelBuilder.Configurations.Add(new RoleMap());
        modelBuilder.Configurations.Add(new NotificationMap());
        modelBuilder.Configurations.Add(new ScheduleMap());
        modelBuilder.Configurations.Add(new ScheduleFileMap());
        modelBuilder.Configurations.Add(new ScheduleLayerMap());
        modelBuilder.Configurations.Add(new SchedulePositionMap());
        modelBuilder.Configurations.Add(new SchedulePlayListMap());
        modelBuilder.Configurations.Add(new SchedulePlayListFileMap());
        modelBuilder.Configurations.Add(new ScheduleScreenMap());
        modelBuilder.Configurations.Add(new ScheduleSettingMap());
        modelBuilder.Configurations.Add(new ScreenMap());
        modelBuilder.Configurations.Add(new ScreenCommandConsoleMap());
        modelBuilder.Configurations.Add(new ScreenCommandMagicInfoMap());
        modelBuilder.Configurations.Add(new ScreenGroupMap());
        modelBuilder.Configurations.Add(new SettingMap());
        modelBuilder.Configurations.Add(new SubFileMap());
        modelBuilder.Configurations.Add(new TemplateMap());
        modelBuilder.Configurations.Add(new UserMap());
        modelBuilder.Configurations.Add(new UserRoleMap());
        modelBuilder.Configurations.Add(new UserNotificationMap());
        modelBuilder.Configurations.Add(new SchemaContentMap());
        modelBuilder.Configurations.Add(new EffectMap());

        base.OnModelCreating(modelBuilder);
    }
    #region IDisposable

    //public void Dispose()
    //{
    //    Dispose(true);
    //    GC.SuppressFinalize(this);
    //}

    //protected virtual void Dispose(bool disposing)
    //{
    //    if (disposing)
    //    {
    //        if (this != null)
    //        {
    //            this.Dispose();
    //        }
    //    }
    //}


    protected override void Dispose(bool disposing)
    {
        var connection = this.Database.Connection;
        base.Dispose(disposing);
        connection.Dispose();

        GC.SuppressFinalize(this);
    }
    #endregion
}

首先我怀疑windsor容器是否因为dbcontext而无法释放控制器。但是每个网络请求解决了IoC容器,然后我认为它应该不是问题。为了确定它,我还添加了idbposable接口到IDbContextFactory,我不知道它是否是正确的使用原因在prodinner示例中它没有像那样使用,根据我的逻辑dbcontextfactory应该按web-request处理。

我切换到深入了解dbcontext我删除了windsor配置并创建了ExampleController,它基本上打开了dbcontext并返回了一些值来查看。 但我意识到,当我调试它时,我仍然在iis工作进程中获得内存增加。这是examplecontroller的代码

     public class ExampleController : Controller
{
    //
    // GET: /Example/

    public ActionResult Index()
    {
        var retval = new DashboardInput();
        //var totalScreens = 2;
        //var totalOfflineScreens = 3;
        //var totalSchedules = 4;
        //var totalFileUploads = 5;

        //List<DashboardScreenInput> offlineScreenList = new List<DashboardScreenInput>();
        //var dashboardScreenInput = new DashboardScreenInput();
        //dashboardScreenInput.Id = 1;
        //dashboardScreenInput.LastCheckInDate = DateTime.Now.TimeAgo();
        //dashboardScreenInput.MacAddress = "10-11-12-AB-E8-D9";
        //dashboardScreenInput.Name = "Test";
        //dashboardScreenInput.ScreenUniqueIdentifier = "ACBASd";
        //offlineScreenList.Add(dashboardScreenInput);
        //offlineScreenList.Add(dashboardScreenInput);

        //List<DashboardFeedInput> feedSystemList = new List<DashboardFeedInput>();
        //List<DashboardFeedInput> feedActivityList = new List<DashboardFeedInput>();

        //var feed = new DashboardFeedInput();
        //feed.Description = "Can çok iyi";
        //feed.Label = 1;
        //feed.RecordDate = DateTime.Now.TimeAgo();
        //feed.Type = 1;
        //feedSystemList.Add(feed);
        //feedSystemList.Add(feed);


        //feedActivityList.Add(feed);
        //feedActivityList.Add(feed);
        //feedActivityList.Add(feed);
        //feedActivityList.Add(feed);
        //retval.FeedsActivity = feedActivityList;
        //retval.FeedsSystem = feedSystemList;
        //retval.OfflineScreens = offlineScreenList;

        //retval.TotalFileUploads = totalFileUploads;
        //retval.TotalOfflineScreens = totalOfflineScreens;
        //retval.TotalSchedules = totalSchedules;
        //retval.TotalScreens = totalScreens;

        using (var db = new Db())
        {

            var totalScreens = db.Screens.Where(o => o.UserID == 1 && !o.IsDeleted).Count();
            var totalOfflineScreens = db.Screens.Where(o => !o.IsOnline && o.UserID == 1 && !o.IsDeleted).Count();
            var totalSchedules = db.Screens.Where(o => o.UserID == 1 && !o.IsDeleted).Count();
            var totalFileUploads = db.Files.Where(o => o.UserID == 1 && o.FileExtension.Extension != ".sch" && o.FileExtension.Extension != ".LFD" && !o.IsDeleted).Count();

            IEnumerable<DashboardScreenInput> offlineScreenList = db.Screens.Where(o => !o.IsOnline && o.UserID == 1 && !o.IsDeleted).OrderByDescending(o => o.LastCheckInDate).Select(o => new { Id = o.Id, Name = o.Name, LastCheckInDate = o.LastCheckInDate, MacAddress = o.MacAddress, ScreenUniqueIdentifier = o.ScreenUniqueIdentifier }).AsEnumerable().Select(o => new DashboardScreenInput { Id = o.Id, Name = o.Name, LastCheckInDate = o.LastCheckInDate.TimeAgo(), MacAddress = o.MacAddress, ScreenUniqueIdentifier = o.ScreenUniqueIdentifier }).ToList();
            IEnumerable<DashboardFeedInput> feedSystemList = db.Feeds.Where(o => o.Type == (byte)Enums.FeedType.System && o.UserID == 1 && !o.IsDeleted).OrderByDescending(o => o.RecordDate).Take(10).Select(o => new { Description = o.Description, Label = o.Label, RecordDate = o.RecordDate, Type = o.Type }).AsEnumerable().Select(o => new DashboardFeedInput { Description = o.Description, Label = o.Label, RecordDate = o.RecordDate.TimeAgo(), Type = o.Type }).ToList();
            IEnumerable<DashboardFeedInput> feedActivityList = db.Feeds.Where(o => o.Type == (byte)Enums.FeedType.Activity && o.UserID == 1 && !o.IsDeleted).OrderByDescending(o => o.RecordDate).Take(10).Select(o => new { Description = o.Description, Label = o.Label, RecordDate = o.RecordDate, Type = o.Type }).AsEnumerable().Select(o => new DashboardFeedInput { Description = o.Description, Label = o.Label, RecordDate = o.RecordDate.TimeAgo(), Type = o.Type }).ToList();

            retval.FeedsActivity = feedActivityList;
            retval.FeedsSystem = feedSystemList;
            retval.OfflineScreens = offlineScreenList;

            retval.TotalFileUploads = totalFileUploads;
            retval.TotalOfflineScreens = totalOfflineScreens;
            retval.TotalSchedules = totalSchedules;
            retval.TotalScreens = totalScreens;
        }
        return View(retval);
    }

}

我也尝试过没有数据库上下文,你可以在注释行中看到。它没有给我任何内存增加。所以我相信我在做某事。我的数据层错了。可能是什么原因?任何想法都表示赞赏。谢谢。

更新1


再次问好,谢谢你的回复。 现在我怀疑mvc项目的原因,现在我正在尝试这个。 我从Global.asax中删除了所有内容,我只是想确保这个应用程序在没有contextfactory或windsor的情况下工作正常,所以我的global.asax类变成了这样。

     public class MvcApplication : System.Web.HttpApplication
{
    protected void Application_Start()
    {
        //Bootstrapper.Bootstrap();
        //AreaRegistration.RegisterAllAreas();

        //WebApiConfig.Register(GlobalConfiguration.Configuration);
        //FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
        RouteConfig.RegisterRoutes(RouteTable.Routes);
    }

    protected void Application_AuthenticateRequest(Object sender, EventArgs e)
    {
        //if (HttpContext.Current.User == null) return;
        //if (!HttpContext.Current.User.Identity.IsAuthenticated) return;
        //if (!(HttpContext.Current.User.Identity is FormsIdentity)) return;

        //var id = HttpContext.Current.User.Identity as FormsIdentity;
        //var ticket = id.Ticket;
        //var userData = ticket.UserData;
        //var roles = userData.Split(new[] { ',' });

        //HttpContext.Current.User = new GenericPrincipal(id, roles);
    }
   }

之后我在vs 2012中创建了一个新的mvc项目。我创建了简单的控制器和视图,以确保在调用新的mvc项目页面时没有发生内存泄漏。它像我预期的那样工作得很好。然后我复制粘贴web.config文件到我的应用程序,所以我可以确定我的web.config文件没有任何问题。这是web.config文件。

<?xml version="1.0" encoding="utf-8"?>
<configuration><configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
 </configSections>
 <connectionStrings>
    <add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-MvcApplication1-20140708015245;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-MvcApplication1-20140708015245.mdf" />
  </connectionStrings>
  <appSettings>
    <add key="webpages:Version" value="2.0.0.0" />
    <add key="webpages:Enabled" value="false" />
    <add key="PreserveLoginUrl" value="true" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
   </appSettings>
  <system.web>
    <httpRuntime targetFramework="4.5" />
    <compilation debug="true" targetFramework="4.5" />
    <authentication mode="Forms">
    <forms loginUrl="~/Account/Login" timeout="2880" />
    </authentication>
    <pages>
    <namespaces>
    <add namespace="System.Web.Helpers" />
    <add namespace="System.Web.Mvc" />
    <add namespace="System.Web.Mvc.Ajax" />
    <add namespace="System.Web.Mvc.Html" />
    <add namespace="System.Web.Optimization" />
    <add namespace="System.Web.Routing" />
    <add namespace="System.Web.WebPages" />
  </namespaces>
</pages>
<profile defaultProvider="DefaultProfileProvider">
  <providers>
    <add name="DefaultProfileProvider" type="System.Web.Providers.DefaultProfileProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" />
  </providers>
</profile>
<membership defaultProvider="DefaultMembershipProvider">
  <providers>
    <add name="DefaultMembershipProvider" type="System.Web.Providers.DefaultMembershipProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
  </providers>
</membership>
<roleManager defaultProvider="DefaultRoleProvider">
  <providers>
    <add name="DefaultRoleProvider" type="System.Web.Providers.DefaultRoleProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" />
  </providers>
</roleManager>
<!--
        If you are deploying to a cloud environment that has multiple web server instances,
        you should change session state mode from "InProc" to "Custom". In addition,
        change the connection string named "DefaultConnection" to connect to an instance
        of SQL Server (including SQL Azure and SQL  Compact) instead of to SQL Server Express.
  -->
<sessionState mode="InProc" customProvider="DefaultSessionProvider">
  <providers>
    <add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" />
  </providers>
</sessionState>
</system.web>
<system.webServer>
   <validation validateIntegratedModeConfiguration="false" />
   <handlers>
     <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
     <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
     <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
     <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
      <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
      <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
       </handlers>
     </system.webServer>
     <runtime>
       <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
       <dependentAssembly>
       <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
       <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
      <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
     </dependentAssembly>
     <dependentAssembly>
       <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
      <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
     </dependentAssembly>
     <dependentAssembly>
        <assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" />
        <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
     </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="1.0.0.0-1.3.0.0" newVersion="1.3.0.0" />
  </dependentAssembly>
</assemblyBinding>
  </runtime>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory,    EntityFramework" />
  </entityFramework>
</configuration>

我使用的是我在第一篇文章ExampleController中使用的相同类。这次我只使用了我给出的硬编码值。这是代码。

 public class ExampleController : Controller
{
    //
    // GET: /Example/

    public ActionResult Index()
    {
        var retval = new DashboardInput();
        var totalScreens = 2;
        var totalOfflineScreens = 3;
        var totalSchedules = 4;
        var totalFileUploads = 5;

        List<DashboardScreenInput> offlineScreenList = new List<DashboardScreenInput>();
        var dashboardScreenInput = new DashboardScreenInput();
        dashboardScreenInput.Id = 1;
        dashboardScreenInput.LastCheckInDate = DateTime.Now.TimeAgo();
        dashboardScreenInput.MacAddress = "10-11-12-AB-E8-D9";
        dashboardScreenInput.Name = "Test";
        dashboardScreenInput.ScreenUniqueIdentifier = "ACBASd";
        offlineScreenList.Add(dashboardScreenInput);
        offlineScreenList.Add(dashboardScreenInput);

        List<DashboardFeedInput> feedSystemList = new List<DashboardFeedInput>();
        List<DashboardFeedInput> feedActivityList = new List<DashboardFeedInput>();

        var feed = new DashboardFeedInput();
        feed.Description = "Can çok iyi";
        feed.Label = 1;
        feed.RecordDate = DateTime.Now.TimeAgo();
        feed.Type = 1;
        feedSystemList.Add(feed);
        feedSystemList.Add(feed);


        feedActivityList.Add(feed);
        feedActivityList.Add(feed);
        feedActivityList.Add(feed);
        feedActivityList.Add(feed);

        retval.FeedsActivity = feedActivityList;
        retval.FeedsSystem = feedSystemList;
        retval.OfflineScreens = offlineScreenList;

        retval.TotalFileUploads = totalFileUploads;
        retval.TotalOfflineScreens = totalOfflineScreens;
        retval.TotalSchedules = totalSchedules;
        retval.TotalScreens = totalScreens;


        //using (var db = new Db())
        //{

        //    var totalScreens = db.Screens.Where(o => o.UserID == 1 && !o.IsDeleted).Count();
        //    var totalOfflineScreens = db.Screens.Where(o => !o.IsOnline && o.UserID == 1 && !o.IsDeleted).Count();
        //    var totalSchedules = db.Screens.Where(o => o.UserID == 1 && !o.IsDeleted).Count();
        //    var totalFileUploads = db.Files.Where(o => o.UserID == 1 && o.FileExtension.Extension != ".sch" && o.FileExtension.Extension != ".LFD" && !o.IsDeleted).Count();

        //    IEnumerable<DashboardScreenInput> offlineScreenList = db.Screens.Where(o => !o.IsOnline && o.UserID == 1 && !o.IsDeleted).OrderByDescending(o => o.LastCheckInDate).Select(o => new { Id = o.Id, Name = o.Name, LastCheckInDate = o.LastCheckInDate, MacAddress = o.MacAddress, ScreenUniqueIdentifier = o.ScreenUniqueIdentifier }).AsEnumerable().Select(o => new DashboardScreenInput { Id = o.Id, Name = o.Name, LastCheckInDate = o.LastCheckInDate.TimeAgo(), MacAddress = o.MacAddress, ScreenUniqueIdentifier = o.ScreenUniqueIdentifier }).ToList();
        //    IEnumerable<DashboardFeedInput> feedSystemList = db.Feeds.Where(o => o.Type == (byte)Enums.FeedType.System && o.UserID == 1 && !o.IsDeleted).OrderByDescending(o => o.RecordDate).Take(10).Select(o => new { Description = o.Description, Label = o.Label, RecordDate = o.RecordDate, Type = o.Type }).AsEnumerable().Select(o => new DashboardFeedInput { Description = o.Description, Label = o.Label, RecordDate = o.RecordDate.TimeAgo(), Type = o.Type }).ToList();
        //    IEnumerable<DashboardFeedInput> feedActivityList = db.Feeds.Where(o => o.Type == (byte)Enums.FeedType.Activity && o.UserID == 1 && !o.IsDeleted).OrderByDescending(o => o.RecordDate).Take(10).Select(o => new { Description = o.Description, Label = o.Label, RecordDate = o.RecordDate, Type = o.Type }).AsEnumerable().Select(o => new DashboardFeedInput { Description = o.Description, Label = o.Label, RecordDate = o.RecordDate.TimeAgo(), Type = o.Type }).ToList();

        //    retval.FeedsActivity = feedActivityList;
        //    retval.FeedsSystem = feedSystemList;
        //    retval.OfflineScreens = offlineScreenList;

        //    retval.TotalFileUploads = totalFileUploads;
        //    retval.TotalOfflineScreens = totalOfflineScreens;
        //    retval.TotalSchedules = totalSchedules;
        //    retval.TotalScreens = totalScreens;
        //    db.SaveChanges();
        //}
        return View(retval);
    }

}

因此在每次页面刷新时它会继续增加内存近1mb。我不明白为什么会这样?我在mvc中不知道的任何其他配置?

1 个答案:

答案 0 :(得分:0)

我删除了所有第三方dll引用并使用nuget将它们再次插入到我的项目中,我没有任何问题。