asp.net 開發注意的幾點
阿新 • • 發佈:2019-01-01
- WIN7中元件服務中的DCOM配置找不到Microsoft Excel應用程式的解決辦法:
這主要是64位系統的問題,excel是32位的元件,所以在正常的系統元件服務裡是看不到的
可以通過在執行裡面輸入 comexp.msc -32 來開啟32位的元件服務,在裡就能看到excel元件了
- Provider=Microsoft.Jet.OLEDB.4.0;Provider=Microsoft.ACE.OLEDB.12.0;
- |DataDirectory|
- connectionString="Data Source=|DataDirectory|MvcMusicStore.sdf"
- Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\aspnet.mdf;Integrated Security=True;User Instance=True
- providerName="System.Data.SqlServerCe.4.0"/>
- IE7 httppostfile物件的FileName會帶客戶端檔案的絕對地址,取檔名時應用Path.GetFileName()
- json如果為了相容IE7瀏覽器返回text型別,則應返回text/plain,text/html在某些情況下客戶端執行JSON.parse會報錯
- Response.Redirect 執行時不會向客戶端寫cookie,應注意這個問題( 經驗證後是執行Response.Redirect後不定cookie, 待驗證???)
- log4net配置 [assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4netTest.config")]
- log4net 程式集呼叫 var log = LogManager.GetLogger(Assembly.GetEntryAssembly(),name);
- log4net ftp下載日誌 報550時 設定 <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
- <%$ %> 屬性程式碼片段,但只能用地伺服器控制元件中 <asp:Label runat="server" Text="<%$ appSettings:test %>"></asp:Label>
- 註冊全域性程式集 gacutil.exe -i dll路徑
-
protected void Application_End(object sender, EventArgs e)
{
var reason = HostingEnvironment.ShutdownReason;
CommFunc.Log.Warn("Application_End, reason:" + reason.ToString());
} -
var traceWriter = request.GetConfiguration().Services.GetTraceWriter();
traceWriter.Trace(request, "", System.Web.Http.Tracing.TraceLevel.Debug, (traceRecord) => { traceRecord.Message = "..." ; }); - cmd重啟appPool c:\windows\system32\inetsrv\AppCmd.exe stop apppool /apppool.name:"ASP.NET v4.0"; c:\windows\system32\inetsrv\AppCmd.exe start apppool /apppool.name:"ASP.NET v4.0"