最近用mvc+ef做了个小站,买了个空间,但空间好像碰到了问题,在我本地运行正确,在服务器空间上“增改”操作却不成功,
不知道是什么原因,是不是服务器要打.net 3.5 sp1补丁还是什么,网址:http://www.codersky.net/Home/Article/1
提交评论 出现以下错误:未将对象引用设置到对象的实例。 
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.NullReferenceException: 未将对象引用设置到对象的实例。源错误: 执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。  堆栈跟踪: 
[NullReferenceException: 未将对象引用设置到对象的实例。]
   System.Reflection.CustomAttribute.GetCustomAttributes(Module decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes) +806[CustomAttributeFormatException: 未找到指定的“IsReference”属性。]
   System.Reflection.CustomAttribute.GetCustomAttributes(Module decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes) +1197
   System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeType type, RuntimeType caType, Boolean inherit) +258
   System.RuntimeType.GetCustomAttributes(Type attributeType, Boolean inherit) +63
   System.ComponentModel.ReflectTypeDescriptionProvider.ReflectGetAttributes(Type type) +262
   System.ComponentModel.ReflectedTypeData.GetAttributes() +36
   System.ComponentModel.DefaultTypeDescriptor.System.ComponentModel.ICustomTypeDescriptor.GetAttributes() +50
   System.ComponentModel.DefaultTypeDescriptor.System.ComponentModel.ICustomTypeDescriptor.GetAttributes() +81
   System.ComponentModel.CustomTypeDescriptor.GetAttributes() +16
   System.Web.Mvc._AssociatedMetadataTypeTypeDescriptor.GetAttributes() +10
   System.Web.Mvc.ModelBinderDictionary.GetBinder(Type modelType, IModelBinder fallbackBinder) +121
   System.Web.Mvc.ModelBinderDictionary.GetBinder(Type modelType, Boolean fallbackToDefault) +62
   System.Web.Mvc.ControllerActionInvoker.GetModelBinder(ParameterDescriptor parameterDescriptor) +65
   System.Web.Mvc.ControllerActionInvoker.GetParameterValue(ControllerContext controllerContext, ParameterDescriptor parameterDescriptor) +36
   System.Web.Mvc.ControllerActionInvoker.GetParameterValues(ControllerContext controllerContext, ActionDescriptor actionDescriptor) +97
   System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +279
   System.Web.Mvc.Controller.ExecuteCore() +114
   System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +33
   System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +4
   System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__4() +37
   System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +21
   System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +69
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +26
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +15
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +13
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +4
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +183
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +161 

解决方案 »

  1.   

    路径会有什么问题,发布后mvc的后台验证也无效了。
      

  2.   

    发布到 本地 测试一下, 服务器上 放个 简单点demo 试试。
      

  3.   

    请问你的数据库表有这个IsReference字段吗?我看了你的网站添加都没有任何验证的,直接就提交了,是不是你没有给IsReference赋值啊!我想也不可能啊!这么简单的问题。那就是给你服务器的配置有关系了。你的服务器配置是IIS6还是什么啊!
      

  4.   

    后台是有判断的,直接用updatemodel,我本地就可以,我也不知道服务器用的什么
      

  5.   

    具体得看操作系统配置和IIS配置等才知道问题原因的,
    楼主还是检查配置吧.
      

  6.   

    本机行上传上去就不行了。。把服务器上防火墙设置一下试试控制面板—安全中心—Windows防火墙—高级—选中网络连接,点击设置,然后选中“Web服务器(HTTP)”,点击确定即可。
      

  7.   

    感谢大家,网站换成mvc+linq的可以支持了,
    网址:http://www.codersky.net
    结贴了。