07
Aug

Failed to execute request because the App-Domain could not be created. Error: 0×80131902

如果在Visual Studio中运行的好好的asp.net网页,部署到IIS后却发现无法运行,在系统日志中可以发现如下类似条目:

Exception: System.Configuration.ConfigurationErrorsException

Message: 引发类型为“System.Configuration.ConfigurationErrorsException”的异常。

StackTrace: 在 System.Web.Configuration.ErrorRuntimeConfig.ErrorConfigRecord.System.Configuration.Internal.IInternalConfigRecord.GetLkgSection(String configKey)
在 System.Web.Configuration.RuntimeConfigLKG.GetSectionObject(String sectionName)
在 System.Web.Configuration.RuntimeConfig.GetSection(String sectionName, Type type, ResultsIndex index)
在 System.Web.Configuration.RuntimeConfig.get_HostingEnvironment()
在 System.Web.Hosting.HostingEnvironment.StartMonitoringForIdleTimeout()
在 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters)
在 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters)
在 System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironment(String appId, IApplicationHost appHost, HostingEnvironmentParameters hostingParameters)
在 System.Web.Hosting.ApplicationManager.CreateAppDomainWithHostingEnvironmentAndReportErrors(String appId, IApplicationHost appHost, HostingEnvironmentParameters hostingParameters)

有关更多信息,请参阅在 http://go.microsoft.com/fwlink/events.asp 的帮助和支持中心。

Failed to execute request because the App-Domain could not be created. Error: 0×80131902

很有可能是IIS的asp.net插件在安装.net(特别是高版本)中造成了损坏,用以下方法修复:

  1. With a command window, get to the latest version of .net under “C:\Windows\Microsoft.Net\Framework\”
  2. Now run the following command: “net stop w3svc” to stop web services.
  3. Then use “aspnet_regiis.exe -ua” to uninstall all instances of ASP.NET from IIS.
  4. Follow with “aspnet_regiis.exe -i” to install ASP.NET into IIS.
  5. Now restart web services with “net start w3svc”.

在我的机器上修复成功。

07
Jul

Visual Studio 2008的版本区别

工作需要,想测试一下微软最新的Visual Studio 2008。

网上找了半天,寻到了一个所谓的Team System,总以为是最高级的了。装了之后才发现是个Architecture Edition,在升级VS2005的那些项目文件时候提示有转换失败,细查之下发现是一个Test项目。后来才想到可能是版本搞错了,去微软的网站查了一下,果不其然,Visual Studio 2008的版本那叫一个复杂,除了Standard EditionProfessional Edition外,还有个Team System,居然可以细分成这么多:

  • Architecture Edition
  • Database Edition
  • Development Edition
  • Test Edition
  • Team Suite

前几个各自的侧重点不同,功能也是各有差异。如果安装两个以上,那就是两者功能的一个合集。
最后一个相当于前面几个的合集,什么功能都有了。

真搞不懂微软花那么大力气推出和维护这么多版本,是否真的有客户愿意买账。

如果想比较专业版和标准版的区别,可以看:这里
如果需要细致比较Team System中各个版本的区别,可以看:这里

另外,有神秘大奖赠送:猛击这里

16
Jun

系统时钟(定时器)可以作为Actor吗?

通常,在一些有定时自动执行功能(类似于计划任务)的系统中,画UML图的时候经常会出现这样的争议:

到底系统时钟(定时器)可以作为Actor来画吗?

下面的文件可能正好解答了你的疑惑:点击查看

如果你只想简单的知道答案,Here it is:不推荐

处理方法:

  1. 将Time作为Secondary Actor
  2. Use case中不加入Time,详情放在Architect文档中说明

详情可参阅上述附件。

12
May

Windows下的最长文件路径

从来没有遇到过也没有去想过的问题,今天机缘巧合碰上了。

事情发生在把Eclipse的各个插件合并起来,准备做一个All-in-one的package的时候。Total Commander 一直报拷贝出错,还以为是以前经常碰到的Linux下大小写文件在windows下重名冲突的问题,仔细看了之后并非如此。一层层目录定位下去,出错的文件并无特殊之处。想了想可能是路径太长的原因,把它移到上层目录果然问题消失。

算了一下,连带路径分隔符“\”及文件名本身,最大支持259个字符(系统为XP,SP2)。

特此记录一下。

18
Mar

[HowTo] Send smarty result page as attachment

Well I encounter this requirement while working on a small CMS. The customer wanna download the report page as attachment in MS-Excel format.

And here is the situation:

  • All the web pages are built with smarty.
  • The report page contains some logic that are already defined within the corresponding smarty template.
  • I have access to PEAR install

So here is the solution I figured out:

  1. Create a new excel file, insert some dummy data, typically with one header row and two data row, and also a row with special format for empty dataset.
  2. Save the file as “web pages”, i.e.: FILENAME.htm
  3. Open the htm file with your favorite text editor, you can see some html tags like “tr” and “td“, just like ordinary html files.
  4. Edit the file as you like, put your logic inside. The dummy data may help you out of some cycle, if/else condition.
  5. Build the page with smarty, following is some pseudo code:

    // some initial statement here, such as retrieving data ...

    ob_start();

    $smarty->assign(Smarty_Variable_In_Htm_File, $yourData);
    //...
    $smarty->display("FILENAME.htm“);

    $htmlResult = ob_get_contents();
    ob_end_clean();

    $dl = new HTTP_Download();
    $dl->setContentType(”application/vnd.ms-excel”);
    $dl->setContentDisposition(HTTP_DOWNLOAD_ATTACHMENT, “ResultReportFile_”.date(’Ymd’).”.xls”);
    $dl->setBufferSize(10 * 1024); // 100 K
    $dl->setData($htmlResult);
    $dl->setCache(false);
    $dl->send();

One thing more, you have to install the “HTTP_Download” package from pear.php.net, together with all of its required dependency.

That’s all.

20
Dec

推荐

Propel,基于PHP5的ORMapping实现,包括一个generator和一个runtime的库,还不错:
http://propel.phpdb.org/

关于在一般的关系数据库(flat)中存贮树形结构的数据,这篇文章值得推荐:
http://www.sitepoint.com/print/hierarchical-data-database