user4264796
user4264796

Reputation:

This <customErrors> error in web.config

I'm trying to fix .I uploaded my project folder to web hosting.My project run in local but shows run time error in we.config file.I dont know how to fix this error.I added the line in system.web still having problem. I deleted the default.aspx page now.IS this problem is due absence of default page.

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

 <?xml version="1.0" encoding="utf-8"?>
  <configuration>
   <configSections>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
   </configSections>
   <connectionStrings>
  <add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-multi_hrms-20150331014837;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-multi_hrms-20150331014837.mdf" />
  </connectionStrings>
   <system.web>
  <customErrors mode="Off"/>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
<pages>
  <namespaces>
    <add namespace="System.Web.Optimization" />
  </namespaces>
  <controls>
    <add assembly="Microsoft.AspNet.Web.Optimization.WebForms" namespace="Microsoft.AspNet.Web.Optimization.WebForms" tagPrefix="webopt" />
  </controls>
</pages>
<authentication mode="None">
  <forms loginUrl="~/Account/Login.aspx" timeout="2880" />
</authentication>
<profile defaultProvider="DefaultProfileProvider">
  <providers>
    <add name="DefaultProfileProvider" type="System.Web.Providers.DefaultProfileProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" />
  </providers>
</profile>
<membership defaultProvider="DefaultMembershipProvider">
  <providers>
    <add name="DefaultMembershipProvider" type="System.Web.Providers.DefaultMembershipProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
  </providers>
</membership>
<roleManager defaultProvider="DefaultRoleProvider">
  <providers>
    <add name="DefaultRoleProvider" type="System.Web.Providers.DefaultRoleProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" />
  </providers>
</roleManager>
<sessionState mode="InProc" customProvider="DefaultSessionProvider">
  <providers>
    <add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" />
  </providers>
</sessionState>
 </system.web>
 <entityFramework>
 <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
  <parameters>
    <parameter value="v11.0" />
  </parameters>
 </defaultConnectionFactory>
 </entityFramework>
</configuration>

Upvotes: 0

Views: 7621

Answers (3)

Rojalin Sahoo
Rojalin Sahoo

Reputation: 1025

if you don't have any page with name as index,default then define the starting page in webconfig file like

 <system.webServer>
     <defaultDocument enabled="true">
        <files>
          <clear/>
          <add value="Home.aspx" />
        </files>
     </defaultDocument>
</system.webServer>

if you don't handle any error cause due to database or any validation or anything in your page then after hosting it will show this error like we get the error page at localhost runtime , so to avoid it you can define one error page in web config file like below for user and check error in localhost.

<configuration>
    <system.web>
        <customErrors mode="RemoteOnly" defaultRedirect="mycustomerrorpage.htm"/>
    </system.web>
</configuration>

note: Home.aspx -- the landing page for the user mycustomerrorpage.html -- the error page the want to show to the user

Upvotes: 1

ECie
ECie

Reputation: 1477

you said it is on a publication server now?? if it is on IIS 7 you must also add a element.

here what it should look

 <system.web>
<!--<processModel maxIoThreads="100" minIoThreads="20"/>-->
<customErrors mode="Off" defaultRedirect="~/Message/DefaultError">
  <error statusCode="404" redirect="~/Message/Error404"/>
  <error statusCode="500" redirect="~/Message/Error500"/>
</customErrors>

<httpRuntime maxRequestLength="10000"/>
<compilation debug="false" targetFramework="4.5"/>
<authentication mode="Forms">
  <forms loginUrl="~/Account/Login" timeout="10"  requireSSL="false"  />
</authentication>
</system.web>

IIS 7 requires the system.webServer node. I run tru same problem before. I also tried tweaking it in IIS configuration manager

Upvotes: 0

Krupa Patel
Krupa Patel

Reputation: 3359

try to change

<authentication mode="None">

via

 <authentication mode="Forms">

Upvotes: 0

Related Questions