LightSwitch app两层部署的疑问

使用LightSwitch开发了一个app,在部署成两层的桌面时,数据库方面老是出问题。搞的我一个头八个大。

我是使用SQL Server 2008 Express版得,因为只是个小小小的app,没有必要搞那么麻烦。可下来的问题也是多多。开始是没怎么在意阅读Install.htm(原文附后),想自己额外按个SQL Server Management Studio附加或者使用脚本部署数据库应该不从在什么问题。结果使用脚本Management Studio报错,通不过,在网上查询资料无果,只好放弃。后来静下心来仔细阅读Install.htm原来直接使用sqlcmd就可以创建数据库,晕!太汗了。

再按着步骤又卡在了5.b,提示

Error is :Could not load file or assembly 'Microsoft.LightSwitch.Base.Server, Version=10.0

.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependenci

 

查资料只有这里(http://social.msdn.microsoft.com/Forums/zh-CN/lightswitchgeneral/thread/55836072-43b7-47f9-a47f-962b9c6fea5f)提到了,可这一句:

The machine you run the admin tool from must have the server pre-requisites installed.  Your development machine would have this, as would the web server where your application is hosted.

 

有点儿太深奥了。。

 

微软开源项目Transport Broker Management System中有关部署的说明:

 

The following steps are necessary to install a 2-tier desktop client application:

1. Install SQL Server Express on the target (client) computer, if not already installed. TMS require SQL Server 2005 or a later version, or SQL Server Express 2005 or a later version. Learn more about SQL Server Express installation options.

2. On the target computer, deploy the database schema by using sqlcmd.exe command tool. The Sqlcmd.exe tool is installed with SQL Server, typically in the \Microsoft SQL Server\100\Tools\Binn directory under the Program Files or Program File (x86) directory.

a. From an elevated Command Prompt, change to the directory TMS1.0 and enter a command similar to the following:

sqlcmd.exe -i TMS.sql -S .\SQLExpress

Replace .\SQLExpress with the database location on the server.

Note : If you want to install database from SQL Server Management Studio, then Open TMS.sql from SQL Server Management Studio.
On Query menu of SQL Management studio select SQL CMD mode and
Execute TMS.sql

3. Locate the web.config file in the Application Files subdirectory of the TMS1.0.

a. Open web.config in Notepad and edit the connection in the <connectionStrings> section to use your server and database name. For example, for the entry similar to:

<add name="_IntrinsicData" connectionString="Data Source=SERVERNAME\SQLEXPRESS;Initial Catalog=TMS;Integrated Security=True;Pooling=True;Connect Timeout=30;User Instance=False" />

Replace SERVERNAME with the name of the database server.

4. Run Setup.exe on the target computer to install the application.


5. You need to provide the default administrator login after installing the app, using the Security Admin tool. The tool SecurityAdmin.exe, can be found under \TMS1.0\Microsoft.LightSwitch.SecurityAdmin.exe

a. To run the tool, open a command prompt and navigate to path for the tool, then type:

Microsoft.LightSwitch.SecurityAdmin.exe /createadmin /user:domainname\username /password:adminpassword /fullname:user'sfullname /config:pathtowebconfig

Replace "domainname\username" with the Username, "adminpassword" with password, "fullname" with full name, and full path to the TMS TMS1.0\Application Files\web.config file. You must also include web.config in the path.

 

 

 

以下是Install.htm原文:

 

Microsoft Visual Studio LightSwitch Application Install Instructions

 The following steps are necessary to install a 2-tier desktop client application:

1.    Install SQL Server Express on the target (client) computer, if not already installed. LightSwitch Applications require SQL Server 2005 or a later version, or SQL Server Express 2005 or a later version. Learn more about SQL Server Express installation options.

2.    On the target computer, deploy the database schema by using sqlcmd.exe command tool. The Sqlcmd.exe tool is installed with SQL Server, typically in the \Microsoft SQL Server\100\Tools\Binn directory under the Program Files or Program File (x86) directory.

a.     From an elevated Command Prompt, change to the directory that contains the publish output and enter a command similar to the following:

 sqlcmd.exe -i MyApplication.sql -S .\SQLExpress

 Replace MyApplication with the name of your application, and replace .\SQLExpress with the database location on the server.

3.    Locate the web.config file in the Application Files subdirectory of the publish output.

a.     Open web.config in Notepad and edit the connection in the <connectionStrings>section to use your server and database name. For example, for the entry similar to:

<add name="_IntrinsicData" connectionString="Data Source=SERVERNAME\SQLEXPRESS;Initial Catalog=MyApplication;Integrated Security=True;Pooling=True;Connect Timeout=30;User Instance=False" />

Replace SERVERNAME with the name of the database server, and replace MyApplication with the name of your application.

4.    Run Setup.exe on the target computer to install the application.

Note: The following step is only necessary if your application uses authentication.

5.    If in the Publish wizard you chose to deploy a database script, you need to provide the default administrator login after deploying the app, using the Security Admin tool. The tool SecurityAdmin.exe, can be found under\Microsoft Visual Studio 10.0\LightSwitch\1.0\Tools\Microsoft.LightSwitch.SecurityAdmin.exe  

a.     To run the tool, open a command prompt and navigate to path for the tool, then type:

Microsoft.LightSwitch.SecurityAdmin.exe /createadmin /user:domainname\username /fullname:user'sfullname /config:pathtowebconfig

Replace the italicized values with the Username, Fullname, and full path to the deployed web.config file for the deployed app. You must also include web.config in the path.

b.     For Windows authentication, no password is required. For Forms authentication, you must also include the password:

Microsoft.LightSwitch.SecurityAdmin.exe /createadmin /user:username /password:password /fullname:user'sfullname /config:pathtowebconfig

Replace the italicized values with the Username, Password, Fullname, and full path to the deployed web.config file for the deployed app. You must also include web.config in the path.

posted @ 2011-11-03 14:09  kissu  阅读(650)  评论(0编辑  收藏  举报