运行MVC5应用程序时,尝试回发到控制器时会出现此错误。
我是在EnsureFiles()方法中发生的,但我根本没有试图加载任何文件。
下面是整个堆栈跟踪
[HttpException (0x80004005): This method or property is not supported after HttpRequest.GetBufferlessInputStream has been invoked.]
System.Web.HttpRequest.EnsureFiles() +3274885
System.Web.HttpRequest.get_Files() +12
System.Web.HttpRequestWrapper.get_Files() +28
System.Web.Mvc.HttpFileCollectionValueProvider.GetHttpPostedFileDictionary(ControllerContext controllerContext) +120
System.Web.Mvc.HttpFileCollectionValueProvider..ctor(ControllerContext controllerContext) +51
System.Web.Mvc.HttpFileCollectionValueProviderFactory.GetValueProvider(ControllerContext controllerContext) +117
System.Web.Mvc.ValueProviderFactoryCollection.GetValueProvider(ControllerContext controllerContext) +160
System.Web.Mvc.ControllerBase.get_ValueProvider() +85
System.Web.Mvc.ControllerActionInvoker.GetParameterValue(ControllerContext controllerContext, ParameterDescriptor parameterDescriptor) +154
System.Web.Mvc.ControllerActionInvoker.GetParameterValues(ControllerContext controllerContext, ActionDescriptor actionDescriptor) +199
System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__19(AsyncCallback asyncCallback, Object asyncState) +1680
System.Web.Mvc.Async.WrappedAsyncResult`1.CallBeginDelegate(AsyncCallback callback, Object callbackState) +59
System.Web.Mvc.Async.WrappedAsyncResultBase`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +151
System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback, Object state, BeginInvokeDelegate beginDelegate, EndInvokeDelegate`1 endDelegate, Object tag, Int32 timeout) +94
System.Web.Mvc.Async.AsyncControllerActionInvoker.BeginInvokeAction(ControllerContext controllerContext, String actionName, AsyncCallback callback, Object state) +559
System.Web.Mvc.Controller.<BeginExecuteCore>b__1c(AsyncCallback asyncCallback, Object asyncState, ExecuteCoreState innerState) +82
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallBeginDelegate(AsyncCallback callback, Object callbackState) +73
System.Web.Mvc.Async.WrappedAsyncResultBase`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +151
System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback, Object callbackState, BeginInvokeDelegate`1 beginDelegate, EndInvokeVoidDelegate`1 endDelegate, TState invokeState, Object tag, Int32 timeout, SynchronizationContext callbackSyncContext) +105
System.Web.Mvc.Controller.BeginExecuteCore(AsyncCallback callback, Object state) +588
System.Web.Mvc.Controller.<BeginExecute>b__14(AsyncCallback asyncCallback, Object callbackState, Controller controller) +47
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallBeginDelegate(AsyncCallback callback, Object callbackState) +65
System.Web.Mvc.Async.WrappedAsyncResultBase`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +151
System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback, Object callbackState, BeginInvokeDelegate`1 beginDelegate, EndInvokeVoidDelegate`1 endDelegate, TState invokeState, Object tag, Int32 timeout, SynchronizationContext callbackSyncContext) +139
System.Web.Mvc.Controller.BeginExecute(RequestContext requestContext, AsyncCallback callback, Object state) +484
System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.BeginExecute(RequestContext requestContext, AsyncCallback callback, Object state) +50
System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__4(AsyncCallback asyncCallback, Object asyncState, ProcessRequestState innerState) +98
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallBeginDelegate(AsyncCallback callback, Object callbackState) +73
System.Web.Mvc.Async.WrappedAsyncResultBase`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +151
System.Web.Mvc.Async.AsyncResultWrapper.Begin(AsyncCallback callback, Object callbackState, BeginInvokeDelegate`1 beginDelegate, EndInvokeVoidDelegate`1 endDelegate, TState invokeState, Object tag, Int32 timeout, SynchronizationContext callbackSyncContext) +106
System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +446
System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state) +88
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) +50
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +301
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155我的表格简单得令人尴尬
@using (Html.BeginForm())
{
<div class="form-group">
In order to continue you must change your password.
</div>
<div class="form-group">
@Html.LabelFor(x=> Model.OldPassword)
@Html.TextBoxFor(x=> Model.OldPassword)
</div>
<div class="form-group">
@Html.LabelFor(x => Model.NewPassword)
@Html.TextBoxFor(x => Model.NewPassword)
</div>
<div class="form-group">
@Html.LabelFor(x => Model.NewPasswordConfirm)
@Html.TextBoxFor(x => Model.NewPasswordConfirm)
</div>
<div class="form-group">
<input type="submit" class="btn btn-primary" value="Submit" />
<input type="reset" class="btn btn-danger" value="Cancel" />
</div>
}以前有没有人遇到过这个问题。我在网上有几次点击,但都没有用。
发布于 2015-03-09 22:10:01
对此的回答是关掉Thinktecture中的IdSrv。
LoggingOptions = new LoggingOptions
{
**EnableHttpLogging = false**,
EnableWebApiDiagnostics = true,
IncludeSensitiveDataInLogs = true,
WebApiDiagnosticsIsVerbose = true,
},发布于 2017-11-29 23:37:15
在将Azure Active身份验证添加到以前没有身份验证的MVC web应用程序时,我也遇到了此错误。
当我将Startup.cs下面的代码从MVC和Web配置代码之后移到前面时,异常就不再发生了。
// Microsoft Azure Active Directory
app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);
app.UseCookieAuthentication(new CookieAuthenticationOptions());
app.UseOpenIdConnectAuthentication(
new OpenIdConnectAuthenticationOptions
{
ClientId = appSettings.IdaClientId,
Authority = appSettings.IdaAuthority,
PostLogoutRedirectUri = appSettings.IdaPostLogoutRedirectUri
});https://stackoverflow.com/questions/28949692
复制相似问题