發表文章

目前顯示的是 7月, 2012的文章

.NET - Windows 2008 Server 中 ASP.NET 使用 Office Application Component 的設定.

圖片
這一二天在 deploy ASP.NET 至 windows 2008 R2 時,因使用 Office Application Component,一直在 deploy 時發生 IIS 7 COMException (0x80004005) 的問題,故在此做個記錄以防之後有類似的情形發生. 因 install Office 為 32 bit ,但在 Server 2008 R2 中的 Component Services 預設是 64 bit 的,看不到 32 bit component,請故在 run 中打入  “ mmc comexp.msc /32 ” 來執行 32 bit 版本的 Component Services. 修改所需的 Permissions 後,即可在 ASP.NET 中呼叫 Office Component 來使用.

C# – NetOffice 產生 Powerpoint 的初體驗

圖片
目前在 .NET 中產生 Powerpoint 並沒有什麼 free library 可用,如需產生 Powerpoint 時只能呼叫 Office Applicaiton 或是自行使用 OpenXML SDK 來產生,之前在 codeplex 中發生有個叫 NetOffice 的 Library ,雖然它也是要依賴 Office Applicaiton ,但它是透過 COM Proxies 的方式來呼叫 Office Applicaiton,已簡化很多的部份並幫解決 Memory Leak 的部份,算是不錯的 solution 之一了. 那在此提供一個簡單的 Sample ,記錄一下如何使用此 component … 1. Reference Library . 2. Source Code using (PowerPoint.Application app = new PowerPoint.Application()) { PowerPoint.Presentation presentation = app.Presentations.Add(MsoTriState.msoFalse); presentation.Slides.Add(1, PpSlideLayout.ppLayoutClipArtAndVerticalText); string filename = string.Format(@"c:\1.pptx"); presentation.SaveAs(filename); app.Quit(); app.Dispose(); } 結果如下所示: 如需其它的 Demo 請參考 NetOffice PowerPoint Examples .

jQuery – File Download plugin

在作 Web 時 Download File 的功能一直都有,但又如何在 User 按下 Download Button 時,出現提示 server 回覆才又隱藏提示呢?這一部份在網路上有很多的 Sample,這裡提個一個還不錯的 jQuery Plugin : jQuery File Download , 癈話不多說請看 Demo .

Configure Project for 32 bit and 64 bit

圖片
最近接了一個 Project ,在 32 bit 上做開發及測試都正常,但拿到 Winodow 2008 R2 (64 bit) 上 Run 就是會有 Exception,那在此記錄一下解決方法. 1. 開啟 Configuration Manager dialog,選取使用中的方案平台. 2. 選取新增, 選取 X64 的 platform 後按下確定 Button.   3. 最後在 Debug / Release 時選取所需的 Platform 已可.

IIS7 – Running 32-bit and 64-bit ASP.NET versions at the same time on different worker process (轉貼)

圖片
In IIS6, this was a pain area. On a 64-bit Windows 2003 Server, you cannot run worker processes in both 32-bit mode and as well as 64 bit mode. Either only one of them was possible. This was possible by the below Metabase Key which would be applied to the W3SVC/AppPools node. W3SVC/AppPools/enable32BitAppOnWin64 : true | false Read more how to do this in IIS 6.0 here . But, in IIS7, you can run 32-bit and 64-bit worker processes simultaneously. Let’s see how to do it. You have the same enable32BitAppOnWin64 property for the applicationPools in the applicationHost.config. Now, you can set this for individual application pools. Below is my sample configuration: <applicationPools> <add name="MyAppPool32bit" autoStart="true" enable32BitAppOnWin64="true" /> <add name="MyAppPool64bit" autoStart="true" enable32BitAppOnWin64="false" /> <applicationPoolDefaults> <processModel identityType="Ne

ASP.NET – Deploy MVC3 web application

圖片
當 ASP.NET MVC3 web application release to production environment,但 production environment 沒有安裝 ASP.NET MVC3,當需 release to production environment 時需收入那些 Library 至 web application bin 中呢? System.Web.Mvc System.Web.Heplers System.Web.Razor System.Web.WebPages System.Web.WebPages.Deployment System.Web.WebPages.Razor Microsoft.Web.Infrastructure Add library to reference 時,執行下面步驟設定 Library 會 copy to local.

ASP.NET MVC In-Depth: The Life of an ASP.NET MVC Request

雖然這是一篇舊的文章,但確能了解 ASP.NET MVC 它的 Life Cycle 為何? The purpose of this blog entry is to describe, in painful detail, each step in the life of an ASP.NET MVC request from birth to death. I want to understand everything that happens when you type a URL in a browser and hit the enter key when requesting a page from an ASP.NET MVC website. Why do I care? There are two reasons. First, one of the promises of ASP.NET MVC is that it will be a very extensible framework. For example, you’ll be able to plug in different view engines to control how your website content is rendered. You also will be able to manipulate how controllers get generated and assigned to particular requests. I want to walk through the steps involved in an ASP.NET MVC page request because I want to discover any and all of these extensibility points. Second, I’m interested in Test-Driven Development. In order to write unit tests for controllers, I need to understand all of the controller dependencies. When writing my tests, I n