2013-11-03 50 views
1

嗨專家你好嗎?我是學生,並使用sql server 2005學習asp.net c#visual studio 2010。我開發了一個擁有數據庫的網站。我通過互聯網幫助開發了這個網站。該網站完成並在我的電腦上完美運行。web.config文件更新指南

我已託管服務器和域名已註冊。

的問題是,當我上傳我的網站不工作有以下錯誤顯示:我上傳網頁到前

Server Error in '/' Application. 

Runtime Error 

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 Configuration File --> 

<configuration> 
    <system.web> 
     <customErrors mode="Off"/> 
    </system.web> 
</configuration> 

Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL. 


<!-- Web.Config Configuration File --> 

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

我在網上,我必須配置我的web.config文件中讀取的地方託管服務器。在我的網站的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="SPConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ShoppingPortal.mdf;Integrated Security=True;User Instance=True" 
    providerName="System.Data.SqlClient" /> 
</connectionStrings> 
    <system.web> 
     <trace enabled="true" localOnly="false" pageOutput="true" /> 
    <compilation debug="true" targetFramework="4.0"/> 
    </system.web> 
</configuration> 

我不知道我應該怎麼編輯它來得到它的託管服務器,請幫我在這方面,我應該怎麼辦一起工作這個。提前謝謝你

+2

錯誤信息實際上是告訴你該怎麼做......在你的節中添加一個''標籤。 – Dan

+0

謝謝先生它爲我工作,但現在它顯示我幾個其他錯誤我修復它們,但其中之一是,我再次擊中錯誤是: 無法識別的屬性'targetFramework'。請注意,屬性名稱區分大小寫。 第13行: Student

+0

[StackOverflow:無法識別的屬性'targetFramework'。請注意,屬性名稱區分大小寫](http://stackoverflow.com/questions/7530725/unrecognized-attribute-targetframework-note-that-attribute-names-are-case-sen) – Dan

回答

2

你得到的錯誤是一個普遍的錯誤,說basicall,「有錯誤」。要找出錯誤是什麼,ASP.NET會要求您將配置設置添加到web.config文件的<system.web>部分。

默認<customerErrors>mode設置爲RemoteOnly。這意味着如果您在本地瀏覽您的網站(使用本地主機),則只能看到完整的錯誤。

因此,要找出錯誤是什麼這在<system.web>部分添加到您的web.config:

<system.web> 
    <customErrors mode="Off" /> 
</system.web> 

這將顯示實際的錯誤信息給你,然後你可以解決它(或交另一個問題 :) )。

修復錯誤後,務必將此設置變爲On。否則,您將向遠程用戶顯示錯誤的完整堆棧跟蹤。

此文檔是here

+0

謝謝先生,它爲我工作但現在它向我展示了幾個我修復它們的錯誤,但其中一個錯誤是,我再次遇到錯誤:無法識別的屬性'targetFramework'。請注意,屬性名稱區分大小寫。第13行: Student

+1

@Student - 將其更改爲'targetframework' - 不要在配置文件中使用駱駝案例。還請注意,**這正是消息所說** – Hogan

+0

,但先生,當我編輯它作爲你所說的targetframework然後它說屬性是不允許的。 – Student