How to create a Global connectionstring to SQL Server Database for my SharePoint site

那年仲夏 提交于 2019-12-08 01:54:26

问题


This is my connection string inside my web.config of my SharePoint site. Its sitting just below the closing SharePoint tag.

<connectionStrings>
    <add name="SAMRASConnectionString" connectionString="Data Source=JOHANDEVVM;
        Initial Catalog=samrasDB; User ID=Johan; Password=password; Trusted_Connection=True"
        providerName="System.Data.SqlClient"  />
</connectionStrings>

Where must i place it in order to get a Global Connectionstring.

Reason be: When i go to my IIS site Properties -> ASP.NET tab -> Edit Global Configuration Then the connection string is not there, its only by the Edit Configuration.

I need it to be there to access it from other client computers. I need to change it in my web.config file and dont want to go add it manually on the Server.


回答1:


Add the connectionString in Machine.Config if you have access to it.




回答2:


You can use an SPWebConfigModification in a feature reciever to add web.config modifications to all servers in a farm.

http://www.crsw.com/mark/Lists/Posts/Post.aspx?ID=32



来源:https://stackoverflow.com/questions/649871/how-to-create-a-global-connectionstring-to-sql-server-database-for-my-sharepoint

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