如何在调试模式下更改灯开关应用程序的连接字符串

如何在调试模式下更改灯开关应用程序的连接字符串

问题描述:

请我如何更改灯开关应用程序的连接字符串以进行调试.我已经关注了这篇文章http://dougseven.com/2010/08/23/data-storage-in-visual-studio-lightswitch-2/

please how do i change the connection string of a lightswitch application for debugging purposes . i have followed this post http://dougseven.com/2010/08/23/data-storage-in-visual-studio-lightswitch-2/

但我似乎可以让它工作.每当我在调试模式下运行应用程序时更改 applicationroot/bin/debug 中的 web.config 时,该文件都会使用文件中的原始值重新创建.

but i can seem to get it to work. anytime i change the web.config in the applicationroot/bin/debug when i run the application in debug mode the file gets recreated with the original value in the file.

我在发布应用程序时更改它没有问题.

i have no problem changing it when publishing the app.

当我在 applicationdefinition.lsml 文件中实现更改时,它没有任何效果

and when i implement the change in the applicationdefinition.lsml file it has no effect

来自 Andy Kung 灯光开关团队:

如果您附加到外部数据源,则可以右键单击该数据源解决方案资源管理器中的节点,选择更新数据源"进行修改无需重新创建屏幕即可获取服务器信息.

If you attach to an external datasource, you can right click on that node in the Solution Explorer and select "Update Datasource" to modify the server info without recreating your screens.

已编辑

...但不是真的.

您应该更改 applicationroot/ServerGenerated/Web.config 而不是 applicationroot/bin/debug/web.config.

You should change applicationroot/ServerGenerated/Web.config instead applicationroot/bin/debug/web.config.

说明:

如果您转向文件视图,则在 Data/ApplicationDefinition.lslm 中,它们是对您的连接字符串的引用:

If you turn to File View, in Data/ApplicationDefinition.lslm they are a reference to your connection string:

然后在 project\ServerGenerated\Web.config 中找到连接字符串:

Then in project\ServerGenerated\Web.config locate the connection string:

<connectionStrings>
    <add name="_IntrinsicData" ... />
    <add name="e8f0cfed-653d-42fc-9617-bcaee11eed91" connectionString="HERE!!!!!!