网站运行的时候会报如下的错误,在本地测试没这样的错,一传到服务器上运行就会报这样的错,有时候有,有时候又没错,出现这样的错到底是什么原因呢?Server Error in '/' Application.
--------------------------------------------------------------------------------Runtime Error 
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine. Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".
<!-- Web.Config Configuration File --><configuration>
    <system.web>
        <customErrors mode="Off"/>
    </system.web>
</configuration>
 Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.
<!-- Web.Config Configuration File --><configuration>
    <system.web>
        <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
    </system.web>
</configuration>
 

解决方案 »

  1.   

    sorry 我的英文实在太烂了,看不懂是啥错误!
      

  2.   

     web.config 文件不是放在www根目录下.而是放在www的子目录下等.这样用户访问这个目录时就会出现提示错误. 解决:  将子目录下的 Asp.net应用程序移到 www根目录下. 这样就可以看到详细错误了.您可以根据错误调整程序. 
      

  3.   

    在<system.web>下加个权限模拟试试,我看着好像是权限的问题呢。
    <IDENTITY impersonate="true" userName="accountname" password="password" />
      

  4.   

    楼上扯淡。web.config哪里都能放。系统的搜索顺序是,先找子目录,再找根目录,根目录没有,就用machine.config。
    要看到详细错误,在web.config里的system.web一节下加一句<customErrors mode="Off"/>,这个错误提示里已经说得很清楚了
      

  5.   

    这个一般不会是权限问题,因为权限问题一般是提示无权访问:You are not authorized. 或者找不到网页之类的错误。
      

  6.   

    先照5楼把customerrors mode设置为off,再看详细错误,再对症下药。
      

  7.   

    我把customerrors mode设置为off之后 报如下的错Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster. 
    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: Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.Source Error: 
    [No relevant source lines]
     Source File: c:\windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\2b0fde3d\e3440a8d\App_Web_jygjodv2.6.cs    Line: 0 网上都是英文的 看不懂 能帮我看看是哪里出错了吗
      

  8.   

    下面的一段错误Stack Trace: 
    [HttpException (0x80004005): Unable to validate data.]
       System.Web.Configuration.MachineKeySection.GetDecodedData(Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Int32& dataLength) +289
       System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +140[ViewStateException: Invalid viewstate. 
    Client IP: 123.97.143.138
    Port: 18674
    User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; QQPinyin 730; .NET CLR 2.0.50727; CIBA; 360SE)
    ViewState: /wEPDwUJNjc4MjgzOTk2D2QWAgIDD2QWBmYPZBYCAgMPEA8WAh4LXyFEYXRhQm91bmRnZBAVCxotLXBsZWFzZSBzZWxlY3QgY2F0ZWdvcnktLQtwbGFzdGljIGN1cAxwbGFzdGljIGJvd2wNcGxhc3RpYyBzcG9vbgtwbGFzdGljIHBvdAtwbGFzdGljIGJveA1wbGFzdGljIHBsYXRlDmNsb3RoZXMgaGFuZ2VyDnBsYXN0aWMgYmFza2V0FHBsYXN0aWMgYnJlYWQgY2xhbXBzBm90aGVycxULGi0tcGxlYXNlIHNlbGVjdCBjYXRlZ29yeS0tATEBMgEzATQBNQE2ATcCMTECMTMCMTUUKwMLZ2dnZ2dnZ2dnZ2dkZAIBD2QWBGYPPCsACQEADxYEHghEYXRhS2V5cxYAHgtfIUl0ZW1Db3VudAIKZBYUZg9kFgICAQ8PFgQeBFRleHQFC3BsYXN0aWMgY3VwHg9Db21tYW5kQXJndW1lbnQFATFkZAIBD2QWAgIBDw8WBB8DBQxwbGFzdGljIGJvd2wfBAUBMmRkAgIPZBYCAgEPDxYEHwMFDXBsYXN0aWMgc3Bvb24fBAUBM2RkAgMPZBYCAgEPDxYEHwMFC3BsYXN0aWMgcG90HwQFATRkZAIED2QWAgIBDw8WBB8DBQtwbGFzdGljIGJveB8EBQE1ZGQCBQ9kFgICAQ8PFgQfAwUNcGxhc3RpYyBwbGF0ZR8EBQE2ZGQCBg9kFgICAQ8PFgQfAwUOY2xvdGhlcyBoYW5nZXIfBAUBN2RkAgcPZBYCAgEPDxYEHwMFDnBsYXN0aWMgYmFza2V0HwQFAjExZGQC...][HttpException (0x80004005): Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.]
       System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError) +106
       System.Web.UI.ViewStateException.ThrowMacValidationError(Exception inner, String persistedState) +14
       System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +242
       System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String serializedState) +4
       System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter, String serializedState) +37
       System.Web.UI.HiddenFieldPageStatePersister.Load() +207
       System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +105
       System.Web.UI.Page.LoadAllState() +43
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6785
       System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +242
       System.Web.UI.Page.ProcessRequest() +80
       System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21
       System.Web.UI.Page.ProcessRequest(HttpContext context) +49
       ASP.index_aspx.ProcessRequest(HttpContext context) in c:\windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\2b0fde3d\e3440a8d\App_Web_jygjodv2.6.cs:0
       System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75 
    --------------------------------------------------------------------------------
    Version Information: Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET Version:2.0.50727.3082 
      

  9.   

    void Application_Error(object sender, EventArgs e) 
        { 
            //在出现未处理的错误时运行的代码
            Response.Write(Server.GetLastError().Message);
            Server.ClearError();
        }
    在global中添加上面的代码看下错误来源吧。新群DotNet Programmer 群号112850311
    欢迎DotNet程序员的加入,来吧,我们共同打造一个好的学习交流场所,我们真诚欢迎您的加入。
      

  10.   

    将wb.config中的EnableViewStateMAC=false