1.    复制配置文件

       复制配置文件是指在winform程序中把配置文件copybin目录。注意这里指的是winform程序,webform程序不存在这个问题(我以前以为webform也要copybin目录,经和Ryu666.NET讨论后,才知道不用copy)。Copy的目的是使C/S结构的应用程序可以在运行时读取或设置配置信息。因为winform程序默认的目录是在BIN目录下,我不知道这个默认目录能不能修改,如果可以,那么copy操作可以省去。
      
C# winform程序,Copy操作可以在  工程属性->通用属性->生成事件的生成后事件命令行中加上 copy "$(ProjectDir)*.config" "$(TargetDir)" 来完成。但对于VB.NETwinform程序,我还没找到有放copy "$(ProjectDir)*.config" "$(TargetDir)的地方。我是用VB.NET的,感觉很不爽,因为要记住每次生成前都要手动的copybin目录下。

        
2. 
WebForm使用企业程序库部署的问题

       
我前几天应用企业程序库作了一个WebForm程序(在我自己的机器(win server 2000)上),做好后想放在Web服务器上,在服务器(win 2003)上装好企业程序库,并运行了
InstallServices.bat测试WebForm程序。却发现如下错误:
 

Security Exception

Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

Exception Details: System.Security.SecurityException: Requested registry access is not allowed.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


      用google查了一下,发现要运行InstallServices.bat。但我明明已经运行过了。于是又运行一次,但还是出现那样的错误。开始我怀疑是win 2003问题,于是在一个同事的机器(也是win 2003)里试了一下,一切很正常。于是我感觉InstallServices.bat没有运行成功,通过双击InstallServices.bat不能发现原因,于是我在web服务器上运行命令行程序,然后把InstallServices.bat 拖到里面执行。发现了InstallServices.bat不能运行的原因:

Error: Unable to locate Visual Studio.NET

InstallServices.bat assumes Visual Studio.NET 2003 has been installed in its def

ault location

("C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE\".)

If you have installed Visual Studio.NET 2003 to a different location, you will n

eed

to update this batch file to reflect that location.

       原来是要安装.NET2003。但是谁会在服务器上安装.NET2003呢。我是直接Copy网页程序到web服务器的,我想是不是应用企业程序库的B/S程序不能这样部署。上google搜了一下关于企业程序库部署的资料,但没有结果,希望高手们指导。

       还有一个关于InstallServices.bat的问题:对C/S结构的应用程序,也必须运行它,如果没有运行。会在事件查看器的应用程序日志里出现关于性能计数器的错误。而运行InstallServices.bat必须要安装好.NET2003,这是否意味着每个客户断都安装.NET2003呢。是不是C/S结构的程序的部署也要注意什么地方呢?

      对于上面的问题,我宁愿相信是我自己没有正确的是使用企业程序库而引起的。我提出这些问题是希望与各位一起讨论,解决这些问题,用好企业程序库。

posted on 2005-11-24 17:05  与雪共舞  阅读(2993)  评论(6编辑  收藏  举报