简体   繁体   中英

How To remove This Web config error, It works Fine on local host but if i uploaded on the server then Errror occured

This is my Web.config File......Following is the error

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.

<?xml version="1.0"?>  
<configuration>
  <appSettings>
     <add key="SqlCon" value="Data Source=173.192.89.445;Initial Catalog=Rent_Driver; user
  </appSettings>
<location path="driversonrent.com" allowOverride="true">
 <system.web>
  <customErrors mode="Off" />
  <roleManager enabled="true"/>
  <compilation debug="true" targetFramework="4.0">
    <assemblies>
      <add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
      <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
      <add assembly="System.Web.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
      <add assembly="System.Web.DynamicData.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    </assemblies>
  </compilation>
  <authentication mode="None">
    <forms name="Loginnew" path="/" loginUrl="Loginnew.aspx" protection="Validation" timeout="30"></forms>
  </authentication>
  <pages controlRenderingCompatibilityVersion="4.0" clientIDMode="AutoID"/>
</system.web>

在此处添加〜:path =“〜/”或在login.aspx之前,以使服务器采用相对路径。

Although the previous answer is technically correct (and acceptable) but it's normally not a good practice to show raw errors to remote users from your production server as they could potentially contain sensitive information and are a put-off to general public.

You might be better off by:

  1. Making a custom error page and handling displaying graceful error message to the users.
  2. Logging errors to an external source (DB, text whatever) for later diagnosis.

There are a lot of articles out there to help you with this kind of implementation if that is what you require.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM