[译]使用单个数据库运行BlogEngine 1.4.5的多个实例
By robot-v1.0
本文链接 https://www.kyfws.com/applications/running-multiple-instances-of-blogengine-1-4-5-wit-zh/
版权声明 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
- 4 分钟阅读 - 1882 个词 阅读量 0[译]使用单个数据库运行BlogEngine 1.4.5的多个实例
原文地址:https://www.codeproject.com/Articles/29338/Running-multiple-instances-of-BlogEngine-1-4-5-wit
原文作者:pkmishra
译文由本站 robot-v1.0 翻译
前言
BlogEngine is a powerful blogging engine and there may be situation in which you would like to use it for multiple websites but one database.
BlogEngine是一个功能强大的博客引擎,在某些情况下,您可能希望将其用于多个网站(一个数据库).
介绍(Introduction)
BlogEngine(BlogEngine) 是一个功能强大的博客引擎,您可能希望将其用于多个网站(一个数据库).一种直接的解决方案是使用不同的表前缀,并在appsettings中的web.config文件中指定相同的表前缀.但是我个人不喜欢将数据存储在两个不同表中的想法.鉴于我正在使用Asp.Net成员资格提供程序,我想利用成员资格提供程序的内置功能来运行具有一个数据库的两个不同应用程序.因此,假设您使用的是Asp.Net成员资格提供程序,那么以下是在一个数据库中运行多个站点所涉及的步骤.(is a powerful blogging engine and there may besituation in which you would like to use it for multiple websites but onedatabase. One straight solution is to use different table prefix and specifythe same in web.config file in appsettings. But I personally don’t like theidea of storing data in two different tables.Given the fact that I am usingAsp.Net membership provider, I would like to leverage built in capabilities ofmembership provider to run two different applications having one singledatabase. So here are the steps involved in running multiple sites with onedatabase, assuming you are using Asp.Net membership provider.)
第1步:(Step1:)配置BlogEngine以使用MSSQL和Asp.netmembership提供程序(Configure BlogEngine to use MSSQL and Asp.netmembership provider)
已经使用MSSQL提供程序的用户可以直接转到步骤2.(Users already using MSSQL provider can move to step 2directly.)
如果可以远程访问托管数据库,则可以直接使用aspnet_regsql工具安装所有必需的表,视图,存储过程等.否则,请使用aspnet_regsql工具在本地创建数据库,然后创建创建表,视图和存储过程等所需的脚本,以便可以在远程托管站点上运行相同的命令.要观看分步指南,请观看此视频(If you can access your hosted database remotely you candirectly use the aspnet_regsql tool to install all required tables, views,storedprocedure etc. Otherwise use aspnet_regsql tool to create the databaselocally and then create a script necessary to create the tables, views andstored procedures etc so that the same may be run on the remote hosted site. Tosee step by step guide see this video)
http://nyveldt.com/misc/BE13SQLMembership.html(http://nyveldt.com/misc/BE13SQLMembership.html)
成功配置为使用MSSQL提供程序后,您将可以看到以下页面.(After you have successfully configured to use MSSQL provideryou will be able to see following page.)
第2步:(Step2:)配置BlogEngine以在整个应用程序中使用ApplicationId.(Configure BlogEngine to use ApplicationId across theapplication.)
2.1运行MultipleInstanceScript.Sql文件.请确保默认检查应用程序名称,该应用程序名称的名称为" BlogEngine".如果您具有不同的应用程序名称,请更改字符串.脚本将ApplicationIdcolumn添加到BlogEngine的所有表中.(2.1 Run the MultipleInstanceScript.Sql file. Be sure tocheck the application name by default it has name ‘BlogEngine’ If you havedifferent application name change the string. The scripts add ApplicationIdcolumn to all the tables of BlogEngine.)
2.2在您的BlogEngine.Core/Providers/Folder中包括DbMultiBlogProvider.cs.(2.2 Include DbMultiBlogProvider.cs in your BlogEngine.Core/Providers/Folder.)
更改web.config文件中的以下设置.(Change following settings in web.config file.)
请注意DbMultiBlogProvider的额外applicationId属性.只需检查您的aspnet_applications表,然后在此处放置相同的applicationId值即可.懒惰,我已经使用ApplicationId代替了应用程序名称.(Note the extra applicationId attribute ofDbMultiBlogProvider. Just check your aspnet_applications table and put the sameapplicationId value here. Well being lazy I have use ApplicationId instead ofapplication name.)
在Appsettings值中添加以下值(Add following values in Appsettings values)
在此,IsPrivateBlogattribute用于标识是否允许匿名访问.评论解释了所有内容.(Here IsPrivateBlogattribute is used to identify if anonymous access is allowed or not. Commentexplains everything.)
而已.(That’s it.)
如果要使用不同的地址部署同一应用程序,只需通过Visual Studio网站管理工具创建一个新应用程序,然后将applicationId更改为新创建的applicationId.主题文件和课程文件附在帖子中.如果您对建立网站有任何困难,请告诉我.(If you want to deploy the same application with a differentaddress Just create a new application through visual studio site administrationtool and change the applicationId to the newly created applicationId. Thescript file and class file is attached with the post. In case you have anydifficulty in setting up website do let me know.)
希望这可以帮助.(Hope this helps.)
PS:同一篇文章已发布到我的博客上(PS: The same article has been posted to my blog on) http://noesispedia.com(http://noesispedia.com)
历史(History)
许可
本文以及所有相关的源代码和文件均已获得The Code Project Open License (CPOL)的许可。
C# .NET ASP.NET Dev Architect 新闻 翻译