简体   繁体   English

IIS 8.5、asp.net IHttpHandler 和 AppsendToLog

[英]IIS 8.5 , asp.net IHttpHandler and AppsendToLog

i have an handler, in which i try to write the data received in POST to log我有一个处理程序,我尝试将在 POST 中收到的数据写入日志

context.Response.AppendToLog(result)

after few hints i got i added the next settings under handlers:在得到一些提示后,我在处理程序下添加了下一个设置:

<add name="test1" verb="*" path="*.ashx"  type="test1"/>

but this causing the next error which i can't find a solution for:但这会导致下一个错误,我找不到解决方案:

 Server Error in '/' Application. at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) Could not load type 'test1'. 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.Web.HttpException: Could not load type 'test1'.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. HttpException (0x80004005): Could not load type &#39;test1&#39;.] System.Web.Compilation.BuildManager.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) +12495353 System.Web.Configuration.HandlerFactoryCache.GetTypeWithAssert(String type) +47 System.Web.Configuration.HandlerFactoryCache.GetHandlerType(String type) +18 System.Web.Configuration.HandlerFactoryCache..ctor(String type) +27 System.Web.HttpApplication.GetFactory(String type) +94 System.Web.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +375 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) +288 [HttpException]: Could not load type &#39;test1&#39;. at System.Web.Compilation.BuildManager.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) at System.Web.Configuration.HandlerFactoryCache.GetTypeWithAssert(String type) at System.Web.Configuration.HandlerFactoryCache.GetHandlerType(String type) at System.Web.Configuration.HandlerFactoryCache..ctor(String type) at System.Web.HttpApplication.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.GetFactory(String type)

which setting is missing or is wrong that causing this error?哪个设置丢失或错误导致此错误?

We usually register the Custom HTTP handler class with the below format in the webconfig file located C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\我们通常在位于C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\webconfig文件中使用以下格式注册自定义 HTTP 处理程序 class。

<system.web>
    <httpHandlers>
      <add path="*.jpg" verb="*" type="MyNameSpace.MyClass, MyDllName" />
    </httpHandlers>
 </system.web>

This way of making the custom handler requires us to precompile the Customhanlder.cs file.这种制作自定义处理程序的方式需要我们预编译Customhanlder.cs文件。

csc /t:library /r:System.Web.dll CustomHandler.cs

Besides, the ASHX file, Generic handler is a common way to achieve your requirement.此外,ASHX 文件,通用处理程序是实现您的要求的常用方法。 There is no need to register it before applying it.申请前无需注册。

the correct place to locate the settings:找到设置的正确位置:

<httpHandlers>
    <add name="test1" verb="*" path="*.ashx"  type="test1"/>
</httpHandlers>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在IIS 8.5中部署ASP.NET RC1 WebApp - Deploy ASP.NET RC1 WebApp in IIS 8.5 IIS 8.5中的ASP.NET RC1 Web应用程序 - ASP.NET RC1 web app in IIS 8.5 IIS 8.5上托管的404错误ASP.NET MVC应用程序 - 404 error ASP.NET MVC application hosted on IIS 8.5 IIS 8.5上的ASP.NET MVC 5网页总是处于空闲状态 - ASP.NET MVC 5 webpage on IIS 8.5 always going to idle IIS 8.5中的OWIN和ASP.net成员身份不起作用 - OWIN and ASP.net membership in IIS 8.5 not working ASP.Net安全:在IHttpHandler中包装请求还是使用RoleProvider? - ASP.Net Security: Wrap Requests in IHttpHandler or use RoleProvider? 在IIS 8.5中的asp.net mvc 5上使用后期处理时出现错误404 - Error 404 in working with post actions on asp.net mvc 5 in IIS 8.5 我可以在由IHttpHandler托管的ASP.NET和现有的ASP.NET页中使用ServiceStack的ISession吗? - Can I use ServiceStack's ISession in a ASP.NET hosted IHttpHandler and existing ASP.NET page? ASP.NET Process.Start在任务管理器中的工作背景,但在IIS8.5(Windows 8.1)上却不在前面 - ASP.NET Process.Start work background in task Manger but not come on front on IIS8.5 (Windows 8.1) 在IIS 8.5中启动ASP.NET 5 MVC 6 Web App时,出现HTTP500和针对HttpPlatformHandler的事件1001 - When launching an ASP.NET 5 MVC 6 Web App in IIS 8.5 I get an HTTP500 and an Event 1001 against the HttpPlatformHandler
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM