通过IIS共享文件夹来实现文件型数据库(如sqlite)分布式部署
ztj100 2025-07-24 23:24 4 浏览 0 评论
楼主话:以下内容,若有不专业处,大胆喷,虚心求教。
起因:要进行一个项目的分布式部署,而这个项目所涉及的其中一个数据库为sqlite(经测试,同为文件型数据库的access也可行),众所周知,sqlite不支持远程访问。但我们这个所谓分布式构成一个局域网即可,所以就想到我们常用的ftp这种共享目录局域网访问的形式。将sqlitedb放到一个固定机子上。
接下来,开始百度,解决方案:
现有2台服务器:(192.168.0.38)A, (192.168.0.202)B ;
A服务器:数据库服务器兼IIS服务器,提供共享文件夹DbShare。
A、B服务器做IIS集群,部署报表系统,使用A提供的DbShare文件。
步骤:
一、创建共享文件
首先建立共享文件
1、将我们A服务器上防止数据库文件的文件夹设置为共享,这里要注意我们设置共享的用户,下面B服务器建立IIS虚拟目录的时候添加的用户要跟此一致,所以我建议可以新建个用户。
新建用户直接下拉框中选择即可。
然后在我们要访问这个共享文件夹的服务器上(也就是我们的A、B服务器),建立网络位置(空白处右键)
2、(A、B服务器中)IIS创建虚拟目录,右击网站,选择添加虚拟目录,要共享出来的文件,右击属性:共享,加入用户权限。
然后点击连接为,选择特定用户,这里的用户即上面我们创建共享文件夹时选择的用户
至此,虚拟目录的创建告一段落。
下面回到sqlite的配置,说是配置,其实就是数据库链接字符串的设置:
<add name="dbConnStr" connectionString="Data Source=\\DESKTOP-F4SH980\dbsqlite\db\sqlite\Blogging_SQLite.db"/>
很简单,只是路径变了而已。
注意点:发布时,要把之前那个特定用户也配置到webconfig中:
<system.web> <identity impersonate="true" userName="zhj" password="123" /> <!--配置好后,发布能运行,iis express 不行,iis express即调试时,得注释掉--> <customErrors mode="Off"/> </system.web>
至此,搭建完成,AB两个IIS服务器均可访问位于同个目录下的db。
这一节搭建完了局域网分布式
下一节再介绍搭建完后,如何用Nginx反向代理服务器进行客户端访问,同时进行一个负载均衡的处理
如果您认为这篇文章还不错或者有所收获,可以点击右下角的【推荐】按钮,因为你的支持是我继续写作,分享的最大动力!
相关推荐
- 10条军规:电商API从数据泄露到高可用的全链路防护
-
电商API接口避坑指南:数据安全、版本兼容与成本控制的10个教训在电商行业数字化转型中,API接口已成为连接平台、商家、用户与第三方服务的核心枢纽。然而,从数据泄露到版本冲突,从成本超支到系统崩溃,A...
- Python 文件处理在实际项目中的困难与应对策略
-
在Python项目开发,文件处理是一项基础且关键的任务。然而,在实际项目中,Python文件处理往往会面临各种各样的困难和挑战,从文件格式兼容性、编码问题,到性能瓶颈、并发访问冲突等。本文将深入...
- The Future of Manufacturing with Custom CNC Parts
-
ThefutureofmanufacturingisincreasinglybeingshapedbytheintegrationofcustomCNC(ComputerNumericalContro...
- Innovative Solutions in Custom CNC Machining
-
Inrecentyears,thelandscapeofcustomCNCmachininghasevolvedrapidly,drivenbyincreasingdemandsforprecisio...
- C#.NET serilog 详解(c# repository)
-
简介Serilog是...
- Custom CNC Machining for Small Batch Production
-
Inmodernmanufacturing,producingsmallbatchesofcustomizedpartshasbecomeanincreasinglycommondemandacros...
- Custom CNC Machining for Customized Solutions
-
Thedemandforcustomizedsolutionsinmanufacturinghasgrownsignificantly,drivenbydiverseindustryneedsandt...
- Revolutionizing Manufacturing with Custom CNC Parts
-
Understandinghowmanufacturingisevolving,especiallythroughtheuseofcustomCNCparts,canseemcomplex.Thisa...
- Breaking Boundaries with Custom CNC Parts
-
BreakingboundarieswithcustomCNCpartsinvolvesexploringhowadvancedmanufacturingtechniquesaretransformi...
- Custom CNC Parts for Aerospace Industry
-
Intherealmofaerospacemanufacturing,precisionandreliabilityareparamount.Thecomponentsthatmakeupaircra...
- Cnc machining for custom parts and components
-
UnderstandingCNCmachiningforcustompartsandcomponentsinvolvesexploringitsprocesses,advantages,andcomm...
- 洞察宇宙(十八):深入理解C语言内存管理
-
分享乐趣,传播快乐,增长见识,留下美好。亲爱的您,这里是LearingYard学苑!今天小编为大家带来“深入理解C语言内存管理”...
- The Art of Crafting Custom CNC Parts
-
UnderstandingtheprocessofcreatingcustomCNCpartscanoftenbeconfusingforbeginnersandevensomeexperienced...
- Tailored Custom CNC Solutions for Automotive
-
Intheautomotiveindustry,precisionandefficiencyarecrucialforproducinghigh-qualityvehiclecomponents.Ta...
- 关于WEB服务器(.NET)一些经验累积(一)
-
以前做过技术支持,把一些遇到的问题累积保存起来,现在发出了。1.问题:未能加载文件或程序集“System.EnterpriseServices.Wrapper.dll”或它的某一个依赖项。拒绝访问。解...
你 发表评论:
欢迎- 一周热门
- 最近发表
-
- 10条军规:电商API从数据泄露到高可用的全链路防护
- Python 文件处理在实际项目中的困难与应对策略
- The Future of Manufacturing with Custom CNC Parts
- Innovative Solutions in Custom CNC Machining
- C#.NET serilog 详解(c# repository)
- Custom CNC Machining for Small Batch Production
- Custom CNC Machining for Customized Solutions
- Revolutionizing Manufacturing with Custom CNC Parts
- Breaking Boundaries with Custom CNC Parts
- Custom CNC Parts for Aerospace Industry
- 标签列表
-
- idea eval reset (50)
- vue dispatch (70)
- update canceled (42)
- order by asc (53)
- spring gateway (67)
- 简单代码编程 贪吃蛇 (40)
- transforms.resize (33)
- redisson trylock (35)
- 卸载node (35)
- np.reshape (33)
- torch.arange (34)
- npm 源 (35)
- vue3 deep (35)
- win10 ssh (35)
- vue foreach (34)
- idea设置编码为utf8 (35)
- vue 数组添加元素 (34)
- std find (34)
- tablefield注解用途 (35)
- python str转json (34)
- java websocket客户端 (34)
- tensor.view (34)
- java jackson (34)
- vmware17pro最新密钥 (34)
- mysql单表最大数据量 (35)