簡體   English   中英

如何清除此Web配置錯誤,在本地主機上工作正常,但如果我在服務器上上傳,則會發生Errror

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

這是我的Web.config文件……以下是錯誤

服務器上發生應用程序錯誤。 該應用程序的當前自定義錯誤設置阻止應用程序錯誤的詳細信息被遠程查看(出於安全原因)。

但是,可以由運行在本地服務器計算機上的瀏覽器查看它。

<?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之前,以使服務器采用相對路徑。

盡管上一個答案在技術上是正確的(並且可以接受),但是通常不是從生產服務器向遠程用戶顯示原始錯誤的好習慣,因為這些錯誤可能包含敏感信息,並且容易受到公眾的歡迎。

您可能會受益於:

  1. 制作自定義錯誤頁面並處理向用戶顯示優美的錯誤消息。
  2. 將錯誤記錄到外部源(數據庫,無論輸入什么文字),以便以后進行診斷。

如果您需要的話,有很多文章可以幫助您實現這種實現。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM