小编Jon*_*ckt的帖子

用于IIS 7的自定义HttpModule集成

我遇到了我构建的自定义错误处理程序的麻烦.它应该是a HttpModule,但当我将它添加到我web.configsystem.webServer/modules标签时,它不会被启动.

这是我的web.config部分:

<system.webServer>
  <modules>
    <add name="AspExceptionHandler" 
         type="Company.Exceptions.AspExceptionHandler, Company.Exceptions" 
         preCondition="managedHandler" />
  </modules>
</system.webServer>
Run Code Online (Sandbox Code Playgroud)

这是我的代码HttpModule:

using System;
using System.Web;
using Company.Settings;
using System.Configuration;

namespace Company.Exceptions
{
  public class AspExceptionHandler : IHttpModule
  {
    public void Dispose() { }

    public void Init(HttpApplication application)
    {
      application.Error += new EventHandler(ErrorHandler);
    }

    private void ErrorHandler(object sender, EventArgs e)
    {
      HttpApplication application = (HttpApplication)sender;
      HttpContext currentContext = application.Context;

      // Gather information5
      Exception currentException = application.Server.GetLastError();
      String errorPage = …
Run Code Online (Sandbox Code Playgroud)

asp.net iis-7 httpmodule integrated-pipeline-mode

8
推荐指数
1
解决办法
1万
查看次数

选择具有实体框架的范围

我有一个问题,试图最大化我们的listview具有页面的性能.

我希望实体框架执行select语句,但只返回结果的范围(range = listview的一页的项目).

我搜索过谷歌,但没有找到任何结果.我只发现我可以做一个.ToList().GetRange(开始索引,结束索引),但是所有项目都会被加载到内存中,这就是我想要避免的...

有人能告诉我是否可以这样做吗?(我不希望使用存储过程或视图或类似的东西,因为我们的ListView具有可重复使用的...)

谢谢!

c# linq-to-entities entity-framework

7
推荐指数
1
解决办法
7589
查看次数