RSS 2.0 Feed
2005-01 Entries
摘要:配置 Caching Application Block 中,需要安装两个服务:InstallUtil Microsoft.ApplicationBlocks.AsynchronousInvocation.MonitorService.exeInstallUtil Microsoft.ApplicationBlocks.AsynchronousInvocation.ROHService.exe这两个服务是:Asynchronous Invocation Application Block 中实现的。具体代码请看上述Block。由于这两个服务的安装代码中,都没有指定 serviceProcessInstaller.Account 的值。默认就是: System.ServiceProcess.ServiceAccount.User; 即,安装服务的时候,需要输入用哪个帐号运行服务。 这时候,问题就来了。在你输入帐号密码后,你会发现服务并没有被安装上,有错误被记录到日志中。服务没被安装上,是因为安装过程中产生的错误,没有当时看到错误,是因为错误被Microsoft.ApplicationBlocks.ExceptionManagement Block 扑捉了,被记录到事件日志中了。日至摘录部分如下: 输入 帐户 +  密码的错误日至:Exception Type: System.ComponentModel.Win32ExceptionNativeErrorCode: 1057ErrorCode: -2147467259Message: 帐户名无效或不存在,或者密码对于指定的帐户名无效。TargetSite: Void Install(System.Collections.IDictionary)HelpLink: NULLSource: System.ServiceProcess 输入 机器名\帐号(或机器名/帐号) +  密码的错误日至:事件类型: 错误事件来源: ExceptionManagerPublishedException事件种类: 无事件 ID: 0日期:  2005-1-25事件:  14:41:02用户:  N/A计算机: HONGJUNDEVELOP描述: General Information *********************************************Additional Info:ExceptionManager.MachineName: HONGJUNDEVELOPExceptionManager.TimeStamp: 2005-1-25 14:41:01ExceptionManager.FullName: Microsoft.ApplicationBlocks.ExceptionManagement, Version=1.0.0.0, Culture=neutral, PublicKeyToken=nullExceptionManager.AppDomainName: InstallUtil.exeExceptionManager.ThreadIdentity: ExceptionManager.WindowsIdentity: HONGJUNDEVELOP\Administrator 1) Exception Information*********************************************Exception Type: System.ComponentModel.Win32ExceptionNativeErrorCode: 1332ErrorCode: -2147467259Message: 帐户名与安全标识间无任何映射完成。TargetSite: Byte[] GetAccountSid(System.String)HelpLink: NULLSource: System.ServiceProcess StackTrace Information*********************************************   at System.ServiceProcess.ServiceProcessInstaller.GetAccountSid(String accountName)   at System.ServiceProcess.ServiceProcessInstaller.Install(IDictionary stateSaver)   at System.Configuration.Install.Installer.Install(IDictionary stateSaver)   at Microsoft.ApplicationBlocks.AsynchronousInvocation.ProjectInstaller.Install(IDictionary stateServer) 同样的问题,如果你的服务程序的安装程序中是如下的设置,很多人都碰到过这个问题:this.serviceProcessInstaller.Account = System.ServiceProcess.ServiceAccount.User; 网上可以搜索到大量类似的问题:比如:http://search.csdn.net/Expert/topic/1567/1567507.xmlhttp://search.csdn.net/Expert/topic/1461/1461479.xml即,如果服务的安装程序中,ServiceProcessInstaller 安装实例的Account属性被设置为 User, 就有可能会出现上述问题。 解决方法目前只找到一种: 不用 this.serviceProcessInstaller.Account = System.ServiceProcess.ServiceAccount.User; 而修改为其他值。 比如修改为下面方式:this.serviceProcessInstaller.Account = System.ServiceProcess.ServiceAccount.LocalSystem; 这样就可以避免这个问题。...[阅读全文]

posted @ | Feedback (10) | Filed Under [ .net 编程心得 技术随笔 ]

摘要:CHM文件中某一个具体页面的连接地址是类似如下的方式:mk:@MSITStore:F:\FAT32.chm::/fat5.htm mk:@MSITStore 是一种特殊的协议,用于读取CHM文件中的内容。 System.Net.HttpWebRequest、System.Net.WebClient、文件对象 这些都不识别这种协议。 如果你用它们来读取这样的文件,会报错误:“无法识别该 URI 前缀。” 好在我们有 XMLHttp 可以识别这种协议 演示代码如下:首先请确保增加了对   Microsoft XML  COM的引用。 可能你的电脑上这个COM有不同版本,无所谓,都可以。 private void button1_Click(object sender, System.EventArgs e) ...{ string DownFileName = @"mk:@MSITStore:F:\FAT32.chm::/fat5.htm"; string SaveFileName = @"C:\11.html"; MSXML2.XMLHTTPClass _xmlHttp = new MSXML2.XMLHTTPClass(); ......[阅读全文]

posted @ | Feedback (9) | Filed Under [ .net 编程心得 技术随笔 ]

摘要:一些系统可能需求把数据导出到Access或者Excel文件格式,以方便的传递数据、打印等。Excel 文件或者 Access这两种需要导出的文件可能并不是事先就存在的,这就需要我们自己编程生成他们,下面整理一下生成这两个文件的一些方法,只罗列最常用的。并不全。 一、首先生成Excel文件。    方案一、如果用Excel保存的只是二维数据,也就是把他当数据库的来用。最简单,你不用引用任何额外组件,只需要用 OLEDB 就可以完成创建Excel文件。 范例代码如下。using System.Data.OleDb; public static void CreateExcelFile2() ...{ string OLEDBConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\\aa2.xls;"; OLEDBConnStr += " Extended Properties=Excel 8.0;"; string strCreateTableSQL = @" CREATE TABLE "; strCreateTableSQL += @" 测试表 "; strCreateTableSQL += @" ( "; strCreateTableSQL += @" ID INTEGER, "; strCreateTableSQL += @" UserID INTEGER, "; strCreateTableSQL += @" UserIP VARCHAR , "; strCreateTableSQL += @" PostTime DATETIME , "; strCreateTableSQL +=......[阅读全文]

posted @ | Feedback (26) | Filed Under [ 数据库开发管理心得 .net 编程心得 技术随笔 ]