2011-04-19 5 views
4

내가 godaddy.com를 통해 사이트를 호스팅하고이 링크입니다 :의 Web.config 파일 오류

http://floridaroadrunners.com/

이 내 web.config 파일입니다 : 내가

<?xml version="1.0"?> 

<!-- 
    For more information on how to configure your ASP.NET application, please visit 
    http://go.microsoft.com/fwlink/?LinkId=169433 
    --> 

<configuration> 
    <connectionStrings> 
    <add name="ApplicationServices" 
     connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" 
     providerName="System.Data.SqlClient" /> 
    </connectionStrings> 

    <system.web> 
    <compilation debug="true" targetFramework="4.0" /> 

    <authentication mode="Forms"> 
     <forms loginUrl="~/Account/Login.aspx" timeout="2880" /> 
    </authentication> 

<customErrors mode="Off"/> 

    <membership> 
     <providers> 
     <clear/> 
     <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" 
      enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" 
      maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" 
      applicationName="/" /> 
     </providers> 
    </membership> 

    <profile> 
     <providers> 
     <clear/> 
     <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/> 
     </providers> 
    </profile> 

    <roleManager enabled="false"> 
     <providers> 
     <clear/> 
     <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" /> 
     <add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" /> 
     </providers> 
    </roleManager> 

    </system.web> 

    <system.webServer> 
    <modules runAllManagedModulesForAllRequests="true"/> 
    </system.webServer> 
</configuration> 

런타임 오류 발생 :

customErrors mode = "off"로 설정했습니다. 여기서 뭐가 잘못 됐니? 4.0 프레임 워크가있는 Visual Studio 2010을 사용하고 있습니다. 감사!

+0

런타임 오류가 무엇입니까? – skaz

+0

내 질문을 편집했습니다. 참조하십시오! –

+0

customErrors가 서버에서 커밋되지 않았습니까? 모드가 실제로 꺼져 있으면 오류가 표시되어야합니다. – skaz

답변

1

서버의 machine.config 또는 applicationHost.config이 (는) web.config 설정보다 우선합니다. 안타깝게도 GoDaddy의 지원 라인에 연락하지 않으면 할 수있는 일은 없습니다.

+0

사실이지만 공유 호스팅 시나리오가 특정 구성 설정을 잠그는 것이 이상하게 보일 수 있습니다. –

+0

고마워요. 나는 그들과 접촉하려고 노력할 것이다. –

+0

그것들은 조금 겁나는 소리가납니다. 나는 Hosting을 위해 그들을 사용하지 않는다. 그래서 나는 그것을 확인하거나 부정 할 수 없다. –

0

customErrorsmodeOff은 대소 문자를 구별합니다. 첫 번째 문자가 대문자인지 확인하십시오.

+0

나는 그것도 보았다. 그러나 게시 된 xml에 OP가 가지고있는 것과 정확하게 일치한다. (나중에 질문에 게시되는 것이 아니다.) – Brook

+0

나는 그것을 검사했다. 그것이 맞는 것처럼 보입니다! –

2

주최자가 customErrors을 사용하도록 설정 한 경우 예외 상황을 파악하고 로깅하는 것을 고려해 볼 수 있습니다.

몇 가지 옵션이 있습니다. 먼저 Elmah

두 번째로 로깅 라이브러리를 사용할 수 있습니다 (NLog가 좋지만 작동 할 수는 있습니다). 그리고 Global.asax.cs에서 Application_Error 이벤트를 잡습니다.

protected void Application_Error(object sender, EventArgs e) 
     { 
      //first, find the exception. any exceptions caught here will be wrapped 
      //by an httpunhandledexception, which doesn't realy help us, so we'll 
      //try to get the inner exception 
      Exception exception = Server.GetLastError(); 
      if (exception.GetType() == typeof(HttpUnhandledException) && exception.InnerException != null) 
      { 
       exception = exception.InnerException; 
      } 

      //get a logger from the container 
      ILogger logger = ObjectFactory.GetInstance<ILogger>(); 
      //log it 
      logger.FatalException("Global Exception", exception); 
     } 

customErrors가 꺼져 있어도 상관없는 기능입니다.

+0

엘마를 사용할 좋은 제안! 그냥 nuget 설치 elmah. –

0

Global.asax에서 오류를 catch하고 예외가있는 전자 메일을 보낼 수 있습니다. Global.asax.cs에서

: 내 ExceptionHandler 클래스에서

void Application_Error(object sender, EventArgs e) 
     { 
      // Code that runs when an unhandled error occurs 
      Exception ex = Server.GetLastError(); 
      ExceptionHandler.SendExceptionEmail(ex, "Unhandled", this.User.Identity.Name, this.Request.RawUrl); 
      Response.Redirect("~/ErrorPage.aspx"); // So the user does not see the ASP.net Error Message 
     } 

내 방법 :

class ExceptionHandler 
    { 
     public static void SendExceptionEmail(Exception ex, string ErrorLocation, string UserName, string url) 
     { 
      SmtpClient mailclient = new SmtpClient(); 
      try 
      { 
       string errorMessage = string.Format("User: {0}\r\nURL: {1}\r\n=====================\r\n{2}", UserName, url, AddExceptionText(ex)); 
       mailclient.Send(ConfigurationManager.AppSettings["ErrorFromEmailAddress"], 
           ConfigurationManager.AppSettings["ErrorEmailAddress"], 
           ConfigurationManager.AppSettings["ErrorEmailSubject"] + " = " + ErrorLocation, 
           errorMessage); 
      } 
      catch { } 
      finally { mailclient.Dispose(); } 
     } 

     private static string AddExceptionText(Exception ex) 
     { 
      string innermessage = string.Empty; 
      if (ex.InnerException != null) 
      { 
       innermessage = string.Format("=======InnerException====== \r\n{0}", ExceptionHandler.AddExceptionText(ex.InnerException)); 
      } 
      string message = string.Format("Message: {0}\r\nSource: {1}\r\nStack:\r\n{2}\r\n\r\n{3}", ex.Message, ex.Source, ex.StackTrace, innermessage); 
      return message; 
     } 
    }