对于asp.net–HttpHandler正在iisexpress中工作,而不是在iis服务器上工作感兴趣的读者,本文将会是一篇不错的选择,我们将详细介绍iis网站一直等待响应,并为您提供关于.net
对于asp.net – Http Handler正在iis express中工作,而不是在iis服务器上工作感兴趣的读者,本文将会是一篇不错的选择,我们将详细介绍iis网站一直等待响应,并为您提供关于.net – HttpHandler在IIS 7中不起作用、asp.net 4路由不工作在iis 7、Asp.Net Coer 解决无法连接到Web 服务器“IIS Express”报错、ASP.NET Core http请求内容过大, IIS服务器 返回 Request Too Long 解决方案的有用信息。
本文目录一览:- asp.net – Http Handler正在iis express中工作,而不是在iis服务器上工作(iis网站一直等待响应)
- .net – HttpHandler在IIS 7中不起作用
- asp.net 4路由不工作在iis 7
- Asp.Net Coer 解决无法连接到Web 服务器“IIS Express”报错
- ASP.NET Core http请求内容过大, IIS服务器 返回 Request Too Long 解决方案
asp.net – Http Handler正在iis express中工作,而不是在iis服务器上工作(iis网站一直等待响应)
对于IIS express,web.config文件包含我已添加的以下部分.以下配置适用于iis express.
<system.web> <httpHandlers> <add verb="*" path="*.pdf" type="QDMS.FileHandler" /> Same add tag for all the files to restrict downloading without session. </httpHandlers> </system.web>
IIS服务器的配置不起作用如下.
<system.webServer> <handlers> <add name="Files" path="*.pdf,*.doc,*.docx,*.rar,*.zip,*.ppt,*.pptx,*.jpg,*.png,*.bmp,*.gif,*.html,*.htm,*.pps" verb="*" type="QDMS.FileHandler" resourceType="Unspecified" requireAccess="script" /> </handlers> </system.webServer>
我的文件处理程序如下
using System; using System.Web; using System.Web.SessionState; using QDMS.Old_App_Code; namespace QDMS { public class FileHandler : IHttpHandler,IReadOnlySessionState { public bool IsReusable { get { return true; } } public void ProcessRequest(HttpContext context) { if (!CheckWetherTheRequestForFileExistOrNot(context)) return; if (CheckUsersForFileDownloading(context)) context.Response.Redirect("~/index.aspx"); else { var rawURL = context.Request.RawUrl; var dotIndex = rawURL.LastIndexOf(".",System.StringComparison.Ordinal); var ext = rawURL.Substring(dotIndex); context.Response.ClearContent(); context.Response.ClearHeaders(); context.Response.ContentType = MIMEEType.Get(ext); context.response.addheader("Content-disposition","attachment"); context.Response.WriteFile(rawURL); context.Response.Flush(); } } public bool CheckWetherTheRequestForFileExistOrNot(HttpContext context) { string url = context.Request.RawUrl.ToLower().Trim(); if (url.Contains(".pdf") || url.Contains(".xls") || url.Contains(".xlsx") || url.Contains(".jpg") || url.Contains(".bmp") || url.Contains(".rar") || url.Contains(".doc") || url.Contains(".docx") || url.Contains(".png") || url.Contains(".gif") || url.Contains(".pptx") || url.Contains(".zip") || url.Contains(".ppt") || url.Contains(".pps") || url.Contains(".htm") || url.Contains(".html")) return true; else return false; } public bool CheckUsersForFileDownloading(HttpContext context) { return (context.Session["FrontHiddenID"] == null) && (context.Session["HiddenID"] == null); } } }
我确信在web.config文件中的部分不正确,这就是它无法正常工作的原因.所以我需要建议来纠正web.config文件中的处理程序部分.
任何有关此问题的建议和帮助将受到高度赞赏
解决方法
<add name="Files" path="*.pdf" verb="*" type="QDMS.FileHandler" resourceType="Unspecified" requireAccess="Script" />
与您的版本有两点不同:
>只有一个文件掩码,您应该为每种文件类型注册一个处理程序
> requireAccess =“脚本”,“脚本”具有大写“S”
希望这会有所帮助
.net – HttpHandler在IIS 7中不起作用
<add verb="GET,HEAD,POST" path="TinyMCE.ashx" type="Moxiecode.TinyMCE.Web.HttpHandler,Moxiecode.TinyMCE" />
当我部署到IIS 7时,处理程序停止工作(404).
我需要做什么来使这项工作?
解决方法
asp.net 4路由不工作在iis 7
<system.webServer> <modules runAllManagedModulesForAllRequests="true"> <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule,System.Web,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a" /> </modules> <validation validateIntegratedModeConfiguration="false" /> </system.webServer>
任何想法如何排序这个问题?
解决方法
并且不要忘记在你的模块中添加runAllManagedModulesForAllRequests =“true”
<system.webServer> <modules runAllManagedModulesForAllRequests="true"> <remove name="UrlRoutingModule"/> <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule,PublicKeyToken=b03f5f7f11d50a3a" /> </modules> <handlers> <add name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd" type="System.Web.httpforbiddenhandler,Version=2.0.0.0,PublicKeyToken=b03f5f7f11d50a3a"/> </handlers> </system.webServer>
Asp.Net Coer 解决无法连接到Web 服务器“IIS Express”报错
错误信息如图:
解决方案:
找到项目目录下的.vs文件夹删除,重新打开程序即可
ASP.NET Core http请求内容过大, IIS服务器 返回 Request Too Long 解决方案
1、修改web.config文件内容如下:
<?xml version="1.0" encoding="utf-8"?> <configuration> <location path="." inheritInChildApplications="false"> <system.webServer> <handlers> <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" /> </handlers> <aspNetCore processpath="dotnet" arguments=".\ZXIT.YDJW.WebServer.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" /> <security> <requestfiltering> <!-- Measured in Bytes --> <requestLimits maxQueryString="1073741824" /> </requestfiltering> </security> </system.webServer> </location> </configuration> <!--ProjectGuid: 960a6dae-a9b5-42a9-a89c-53e685724991-->
2、后台接收解除文件大小限制
[HttpPost] [disableRequestSizeLimit] public IActionResult SendNotice(string content) { return Json(new { msg = "ok", info = content }); }
关于asp.net – Http Handler正在iis express中工作,而不是在iis服务器上工作和iis网站一直等待响应的介绍现已完结,谢谢您的耐心阅读,如果想了解更多关于.net – HttpHandler在IIS 7中不起作用、asp.net 4路由不工作在iis 7、Asp.Net Coer 解决无法连接到Web 服务器“IIS Express”报错、ASP.NET Core http请求内容过大, IIS服务器 返回 Request Too Long 解决方案的相关知识,请在本站寻找。
本文标签: