每次我必须使用IIS7为ASP.NET添加处理程序或模块时,指令总是告诉我将它合并为两个部分:system.web和system.webserver.
<system.web>
<httpHandlers>
</httpHandlers>
<httpModules>
</httpModules>
</system.web>
Run Code Online (Sandbox Code Playgroud)
还有这个:
<system.webServer>
<modules>
</modules>
<handlers>
</handlers>
</system.webServer>
Run Code Online (Sandbox Code Playgroud)
这两个部分有什么区别?
此外,如果我不将它添加到该system.web部分,我的Visual Studio 2008调试器也无法正常工作.
我引用了MvcMiniProfiler的1.6版本(通过Nuget),并按照项目主页http://code.google.com/p/mvc-mini-profiler/上的说明设置了所有内容.
我在Web.config中有以下代码:
<system.data>
<DbProviderFactories>
<remove invariant="MvcMiniProfiler.Data.ProfiledDbProvider" />
<add name="MvcMiniProfiler.Data.ProfiledDbProvider" invariant="MvcMiniProfiler.Data.ProfiledDbProvider" description="MvcMiniProfiler.Data.ProfiledDbProvider" type="MvcMiniProfiler.Data.ProfiledDbProviderFactory, MvcMiniProfiler, Version=1.6.0.0, Culture=neutral, PublicKeyToken=b44f9351044011a3" />
</DbProviderFactories>
</system.data>
Run Code Online (Sandbox Code Playgroud)
(项目主页的版本= 1.5.0.0 - NuGet包已经更新)
我在Global.asax中有以下代码(以及在Web.config中定义的连接字符串):
protected void Application_Start()
{
Log.Info("ReCoupon has started.");
AreaRegistration.RegisterAllAreas();
RegisterGlobalFilters(GlobalFilters.Filters);
RegisterRoutes(RouteTable.Routes);
var factory = new SqlConnectionFactory(ConfigurationManager.ConnectionStrings["ReCouponContext"].ConnectionString);
var profiled = new MvcMiniProfiler.Data.ProfiledDbConnectionFactory(factory);
Database.DefaultConnectionFactory = profiled;
Database.SetInitializer(new ReCouponContextInitializer());
}
Run Code Online (Sandbox Code Playgroud)
分析器工作得很好,除了我不能让它来分析SQL.我正在使用SQL Server 2008 Express.我一直在关注Google Code项目主页上的相关问题而且完全陷入困境.
code-first entity-framework-4 asp.net-mvc-3 mvc-mini-profiler
我的ASP.NET MVC应用程序位于IIS 6.0 webroot文件夹中名为Stuff的文件夹中.所以我以http:// localhost/Stuff/Posts的形式访问我的页面.当我使用Visual Studio的内置Web服务器时,我有EMLAH工作.现在当我访问http://localhost/Stuff/elmah.axd时,我得到资源未找到错误.谁能在这里指出我的错误!这是配置文件条目,
<add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah"/> //Handler
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah"/>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah"/> //Module
Run Code Online (Sandbox Code Playgroud) 我想写这个
<elmah>
<errorlog type="Elmah.XmlFilerErrorLog, Elmah" logPath="~/App_Data" />
</elmah>
Run Code Online (Sandbox Code Playgroud)
要么
<elmah>
<errorLog type="Elmah.SQLiteErrorLog, Elmah" logPath="~/App_Data" />
</elmah>
Run Code Online (Sandbox Code Playgroud)
但是我尝试将这个标签放入的每个地方都会Unrecognized configuration section elmah.出错.我发现这个问题配置ELMAH:无法识别的配置部分错误,但我尝试了(问题底部的解决方案)仍然得到错误.我把它放在哪里?
-edit-我发现了这个问题.我没有<sectionGroup name="elmah">正确设置.我无法在网上找到它然后记得演示有sqlite日志记录,我检查了演示配置的线索.
我使用ELMAH作为我的MVC 3应用程序与Gmail.我已经使用了几个关于如何执行此操作的参考,包括此StackOverflow问题,该问题涉及多个修复程序
我仍然无法确定为什么我没有收到来自elmah的电子邮件.我试图通过在我调用的代码中抛出NullReferenceException来测试它.
我的web.config如下所示:
<configuration>
<configSections>
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
</sectionGroup>
<sectionGroup name="elmah">
<section name="errorMail" requirePermission="false" type="Elmah.ErrorMailSectionHandler, Elmah"/>
<section name="security" requirePermission="false" type="Elmah.SecuritySectionHandler, Elmah"/>
<section name="errorLog" requirePermission="false" type="Elmah.ErrorLogSectionHandler, Elmah"/>
<section name="errorFilter" requirePermission="false" type="Elmah.ErrorFilterSectionHandler, Elmah"/>
</sectionGroup>
</configSections>
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" /> …Run Code Online (Sandbox Code Playgroud)