在本文中,我们将为您详细介绍如何从ASP.NETMVC中的自定义帮助程序中访问当前的System.Web.Routing.RequestContext?的相关知识,此外,我们还会提供一些关于.NETS
在本文中,我们将为您详细介绍如何从ASP.NET MVC中的自定义帮助程序中访问当前的System.Web.Routing.RequestContext?的相关知识,此外,我们还会提供一些关于.NET System.Web.HttpContext.Current.Request报索引超出数组界限。、.net – 什么是System.Web.Mvc.MvcHandler.ProcessAsyncRequest()?、ASP.NET MVC中的asp.net-mvc – 文件大小上传限制:web.config中的超过1个maxRequestLength设置、asp.net – RedirectToAction MVC2的问题 – 不能将类型“System.Web.Mvc.RedirectToRouteResult”隐式转换为“System.Web.Mvc.ViewResult”的有用信息。
本文目录一览:- 如何从ASP.NET MVC中的自定义帮助程序中访问当前的System.Web.Routing.RequestContext?
- .NET System.Web.HttpContext.Current.Request报索引超出数组界限。
- .net – 什么是System.Web.Mvc.MvcHandler.ProcessAsyncRequest()?
- ASP.NET MVC中的asp.net-mvc – 文件大小上传限制:web.config中的超过1个maxRequestLength设置
- asp.net – RedirectToAction MVC2的问题 – 不能将类型“System.Web.Mvc.RedirectToRouteResult”隐式转换为“System.Web.Mvc.ViewResult”
如何从ASP.NET MVC中的自定义帮助程序中访问当前的System.Web.Routing.RequestContext?
解决方法
public static string NewHelperMethod(this HtmlHelper helper) { UrlHelper url = new UrlHelper(helper.ViewContext.RequestContext);
.NET System.Web.HttpContext.Current.Request报索引超出数组界限。
移动端使用Dio发送 FormData, 请求类型 multipart/form-data
, FormData内可以一个或多个包含文件时。
请求接口时获取上传的fomdata数据使用 System.Web.HttpContext.Current.Request 接受时 报索引超出数组界限问题。
使用MultipartFormDataStreamProvider接受数据不受影响。
解决过程不多说。说多了都是泪。下面是解决方案
解决方法:
1.修改IIS的applicationhost.config
a.文件位置: %windir%/system32/inetsrv/config/applicationhost.config
b.找到 <requestFiltering> 节点
c.然后找到<serverRuntime />此项。如果设置了uploadReadAheadSize的大小 则删除掉就可以了。
附加知识点:
iis7上传文件大小是有限制的。根据自己需求来进行设置相对应的处理
1.web.config中添加如下内容
<configuration>
<system.web>
<httpRuntime maxRequestLength="上传大小的值(单位:byte)" executionTimeout="120"/>
</system.web>
</configuration>
2.web.config中,把以下内容加在<system.webServer>节点
<security>
<requestFiltering >
<requestLimits maxAllowedContentLength="上传大小的值(单位:KB)" >
</requestLimits>
</requestFiltering>
</security>
.net – 什么是System.Web.Mvc.MvcHandler.ProcessAsyncRequest()?
此函数调用可能需要300毫秒到100秒(严重的是100秒).我试图搜索msdn文档,但http://msdn.microsoft.com/en-us/library/system.web.mvc.mvchandler.aspx上没有任何内容
显然,这里有些东西在骗我.
我有一些理论说明为什么这么长时间:
>类型推断?我正在使用结构图.
>服务器资源问题?
> .net版本不兼容某种?
> asp.net mvc某种不兼容性?
环境:
.net 4
asp.net mvc 3
专用的vm
解决方法
因此,我认为它可能是New Relic注入的东西,或者正如你所说的那样,是一种红鲱鱼,有些东西对我们说谎!我关闭了New Relic,并与他们的支持团队联系.
今天,在收到来自New Relic团队的一位反应灵敏且彬彬有礼的成员的几封电子邮件之后,他们又回到我身边并确认这是一个错误(各种各样).以下是他们的回复:
ProcessAsyncRequest is a custom name that we use for any metric being
recorded that is not / does not inherit from “System.Web.UI.Page.”
Given that MVC view engine uses “System.Web.Mvc.ViewPage” all of those
metrics will incorrectly fall under the New Relic moniker of
“ProcessAsyncRequest.”I will be working on a modification to the agent and the core
instrumentation that will hopefully aggregate these metrics
appropriately. I am sorry for the confusion and trouble this has
caused you.I’ll give you an update as I get close to a solution.
编辑:下面的New Relic的进一步回复 – 看起来他们有一个修复到位.
I just pushed a commit that will help us better classify the
transactions coming from the installed agent.As far as the performance issue we did discover an issue reported by
the awesome engineers at AppHarbor that was causing TypeLoadExceptions
which might be related to slow loading / compiling code being put into
the cache. We have found the cause and are in the final testing phases
of that fix and we are hoping to get the fix in the next release of
the agent.
来自New Relic的尼克非常出色地回应了这一点,他们的产品非常有用,所以我没有任何不好的感受,只是想我会在这里分享细节.
很高兴发现我的MVC应用程序中没有鬼魂!
现在,我对任何有这些问题的人的建议是关闭New Relic直到他们的下一个版本.
编辑2:New Relic的Nick今天通过电子邮件发送给我 – 他们最新的代理(版本2.0.9.15) – 现在已经可以使用,应该可以解决这个问题.
ASP.NET MVC中的asp.net-mvc – 文件大小上传限制:web.config中的超过1个maxRequestLength设置
单一设置按预期工作:
<httpRuntime executionTimeout="60" maxRequestLength="1024" />
我试图在根web.config中有2个位置部分的设置,但没有任何成功。我不知道在“路径” – 视图的物理aspx页面或控制器操作中写什么…但是,似乎没有任何效果。
<location path="/File/"> <system.web> <httpRuntime executionTimeout="60" maxRequestLength="4096" /> </system.web> </location> <location path="/Picture/"> <system.web> <httpRuntime executionTimeout="60" maxRequestLength="1024" /> </system.web> </location>
我试图将另一个web.config放在一个特定的视图文件夹(例如/ Views / Picture / …)中,就像它在经典的Webform ASP.NET中工作一样,但这似乎也不是窍门…
<location path=""> <system.web> <httpRuntime executionTimeout="60" maxRequestLength="1024" /> </system.web> </location>
无论我做什么,只应用httpRuntime.maxRequestLength的一个值 – 在(root)web.config … system.web中。
解决方法
asp.net – RedirectToAction MVC2的问题 – 不能将类型“System.Web.Mvc.RedirectToRouteResult”隐式转换为“System.Web.Mvc.ViewResult”
不能将类型“System.Web.Mvc.RedirectToRouteResult”隐式转换为“System.Web.Mvc.ViewResult”
[HttpPost] public ViewResult Edit(Customer customer) { if (ModelState.IsValid) { customersRepository.SaveCustomer(customer); TempData["message"] = customer.CustomerName + " has been saved."; return RedirectToAction("Index"); } else //validation error,so redisplay the same view return View(customer); }
问候
利亚姆
解决方法
ViewResult派生自ActionResult,只能返回视图.由于您的代码可以返回View或重定向,因此您应该使用ActionResult.有关详细信息,请参阅this answer.
今天关于如何从ASP.NET MVC中的自定义帮助程序中访问当前的System.Web.Routing.RequestContext?的分享就到这里,希望大家有所收获,若想了解更多关于.NET System.Web.HttpContext.Current.Request报索引超出数组界限。、.net – 什么是System.Web.Mvc.MvcHandler.ProcessAsyncRequest()?、ASP.NET MVC中的asp.net-mvc – 文件大小上传限制:web.config中的超过1个maxRequestLength设置、asp.net – RedirectToAction MVC2的问题 – 不能将类型“System.Web.Mvc.RedirectToRouteResult”隐式转换为“System.Web.Mvc.ViewResult”等相关知识,可以在本站进行查询。
本文标签: