我在somee.com上使用免費程序計劃。大約一個月前,我第一次上傳我的asp.net網站,它沒有任何錯誤地運行。現在我使用VS2010對網站進行了許多更改,並決定上傳新版本。但服務器一直顯示「編譯錯誤」消息:服務器返回編譯錯誤
Compiler Error Message: CS1061: 'pwblog.BusinessObject.ArticleBo' does not contain a definition for 'FormatDate' and no extension method 'FormatDate' accepting a first argument of type 'pwblog.BusinessObject.ArticleBo' could be found (are you missing a using directive or an assembly reference?)
Source Error:
Line 61: pagedDataSource.DataSource = articleBo.FormatDate(Articles);
這裏是我的FormatDate功能:
internal Article[] FormatDate(Article[] source)
{
if (source != null && source.Length > 0)
{
foreach (Article art in source)
{
art.DatePost = DateTime.Parse(art.DatePost).ToShortDateString();
}
}
return source;
}
其實有一個與功能沒有問題。當我使用VS2010進行調試時,它運行良好。我認識到舊的和新上傳的唯一區別是,我將MSSQL從2008 SP2更改爲2008 R2 SP2,原因在於我已將操作系統從Windows 7更改爲Windows 8.
另外,這裏是我的web.config文件:
<?xml version="1.0"?>
<configuration>
<connectionStrings>
<add name="AssignmentsFinalConnectionString" connectionString="workstation id=pwblog01.mssql.somee.com;packet size=4096;user id=pwblog;pwd=Duc123456;data source=pwblog01.mssql.somee.com;persist security info=False;initial catalog=pwblog01"
providerName="System.Data.SqlClient" />
<add name="AssignmentsFinalConnectionString1" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\AssignmentsFinal.mdf;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<authentication mode="Forms">
<forms name="MYWEBAPP.ASPXAUTH" loginUrl="Web\Login.aspx" protection="All" path="/" defaultUrl="Web\"/>
</authentication>
<authorization>
<allow users="*"/>
</authorization>
<compilation debug="true"/>
<globalization uiCulture="vi" culture="vi-VN"/>
<customErrors mode="Off" >
</customErrors>
</system.web>
<system.webServer>
<defaultDocument>
<files>
<add value="index.aspx" />
</files>
</defaultDocument>
</system.webServer>
</configuration>
(pastebin)
好了,我不相信MSSQL造成問題,但我沒有任何其他線索。關於這個錯誤,附有一個很長的細節messasge,所以我不把它放在這裏。所以,任何意見表示讚賞。 :)
什麼是實際線路給出錯誤信息?您顯示的是定義,但不是實際的呼叫。 –
我發佈了源錯誤。正如我所說的,它在本地正確運行,只是在上傳到在線主機後拋出錯誤。請仔細看看這個鏈接(我的錯誤網站):http://pwblog.somee.com/Web/default.aspx – ducnh
聲明'internal'的方法只能在同一個程序集的文件中訪問。它是在同一個程序集中的'pagedDataSource'嗎?你可以嘗試改變你的訪問修飾符爲'public'並檢查它是否有效嗎? – Steve