0

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>
User2012384
  • 4,769
  • 16
  • 70
  • 106

3 Answers3

1

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

Rojalin Sahoo
  • 1,025
  • 1
  • 7
  • 18
0

try to change

<authentication mode="None">

via

 <authentication mode="Forms">
Krupa Patel
  • 3,309
  • 3
  • 23
  • 28
0

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

ECie
  • 1,265
  • 4
  • 21
  • 50
  • I replaced with this code but haveing new error 500 - Internal server error. What is IIS and how to setup? –  Apr 17 '15 at 06:31
  • where are you testing from?? cassini (visual studio) or on an IIS server?? – ECie Apr 17 '15 at 06:34
  • just delete the node on my example it should go like this: – ECie Apr 17 '15 at 06:38
  • replace the values to your own error page paths: error statusCode="404" redirect="~/Views/Error/Error404.html" for example – ECie Apr 17 '15 at 06:39
  • the one you want to show if error 404 or 500 if ever there are. you can create them your own. thats why it is called custom. they can be as an html or cshtml or whatsoever in your own application – ECie Apr 17 '15 at 06:44
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/75470/discussion-between-vani-and-edu-cielo). –  Apr 17 '15 at 06:45