how to change the connectionstrings of a lightswitch application in debug mode

白昼怎懂夜的黑 提交于 2019-12-10 13:46:17

问题


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/

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.

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


回答1:


From Andy Kung lightswitch team:

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.

EDITED

... but is not true.

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

Explanation:

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

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

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



回答2:


A little late but just in case... If you right-click the datasource then select "Update Datasource" then WAIT for the connection to fail (if the original server is not available) then hit 'Back' you be taken to the connection settings. Just update the connection settings and continue as normal.



来源:https://stackoverflow.com/questions/13314643/how-to-change-the-connectionstrings-of-a-lightswitch-application-in-debug-mode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!