首页 文章 精选 留言 我的

精选列表

搜索[Java框架],共10000篇文章
优秀的个人博客,低调大师

Rafy 领域实体框架演示(3) - 快速使用 C/S 架构部署

前言 截止到上一篇,我们开发的应用程序都是采用直接连接数据库的模式: 接下来,将通过一些简单的调整,使得这个应用程序支持以 C/S 架构部署。整个过程只需要少量的代码: 包含以下步骤: 添加服务端控制台应用程序项目 修改客户端应用程序连接方式 配置客户端应用程序 运行示例 代码下载 添加服务端控制台应用程序项目 在整个解决方案中添加一个新的控制台应用程序,取名为 ServerConsole: 为项目添加所有 Rafy 程序集、CS 实体程序集以及 System.ServiceModel 程序集的引用: 在 Main 函数中添加以下代码,启动服务端领域项目,并开始监听 WCF 端口: 1: using System; 2: using System.Collections.Generic; 3: using System.Linq; 4: using System.ServiceModel; 5: using System.Text; 6: using CS; 7: using Rafy; 8: using Rafy.Domain; 9: 10: namespace ServerConsole 11: { 12: class Program 13: { 14: static void Main(string[] args) 15: { 16: PluginTable.DomainLibraries.AddPlugin<CSPlugin>(); 17: new DomainApp().Startup(); 18: 19: using (ServiceHost serviceHost = new ServiceHost(typeof(Rafy.DataPortal.WCF.ServerPortal))) 20: { 21: serviceHost.Open(); 22: Console.WriteLine("Press <enter> to terminate service"); 23: Console.ReadLine(); 24: serviceHost.Close(); 25: } 26: } 27: } 28: } 然后,为本项目添加应用程序配置文件 App.config,代码如下: 1: <?xml version="1.0" encoding="utf-8" ?> 2: <configuration> 3: <appSettings> 4: <add key="SQL_TRACE_FILE" value="D:\SQLTraceLog.txt"/> 5: </appSettings> 6: <connectionStrings> 7: <add name="CS" connectionString="server=.\SQLExpress;database=ClothesSys;uid=sa;pwd=GIX4" providerName="System.Data.SqlClient"/> 8: </connectionStrings> 9: <system.serviceModel> 10: <services> 11: <service name="Rafy.DataPortal.WCF.ServerPortal" behaviorConfiguration="includesException"> 12: <endpoint address="/Text" binding="basicHttpBinding" contract="Rafy.DataPortal.WCF.IWcfPortal"/> 13: <host> 14: <baseAddresses> 15: <add baseAddress="http://localhost:8000/RafyServer" /> 16: </baseAddresses> 17: </host> 18: </service> 19: </services> 20: <behaviors> 21: <serviceBehaviors> 22: <behavior name="includesException"> 23: <serviceMetadata httpGetEnabled="true" /> 24: <serviceDebug includeExceptionDetailInFaults="true" /> 25: </behavior> 26: </serviceBehaviors> 27: </behaviors> 28: </system.serviceModel> 29: </configuration> 修改客户端应用程序连接方式 接下来需要把界面程序变更为连接服务端。打开 ClothesSys 项目中的 Program.cs 文件,修改为以下代码: 1: static class Program 2: { 3: /// <summary> 4: /// 应用程序的主入口点。 5: /// </summary> 6: [STAThread] 7: static void Main() 8: { 9: PluginTable.DomainLibraries.AddPlugin<CSPlugin>(); 10: new ClientDomainApp().Startup(); 11: 12: Application.EnableVisualStyles(); 13: Application.SetCompatibleTextRenderingDefault(false); 14: Application.Run(new formLogin()); 15: } 16: } 17: 18: /// <summary> 19: /// 客户端使用的应用程序类型。 20: /// </summary> 21: public class ClientDomainApp : DomainApp 22: { 23: protected override void InitEnvironment() 24: { 25: RafyEnvironment.Location.DataPortalMode = DataPortalMode.ThroughService; 26: 27: base.InitEnvironment(); 28: } 29: } RafyEnvironment.Location.DataPortalMode 表示连接数据的模式,默认值是DataPortalMode.ConnectDirectly(直接连接数据库),ClientDomainApp 类把该值变更为 DataPortalMode. ThroughService(通过服务连接数据)。 配置客户端应用程序 在客户端配置文件中,删除数据库连接配置,并添加 WCF 连接配置,如下: 1: <?xml version="1.0"?> 2: <configuration> 3: <configSections> 4: <section name="rafy" type="Rafy.Configuration.RafyConfigurationSection, Rafy" /> 5: </configSections> 6: <rafy 7: dataPortalProxy="Rafy.DataPortal.WCF.ClientProxy, Rafy.Domain" 8: collectDevLanguages="IsDebugging"> 9: </rafy> 10: <system.serviceModel> 11: <client> 12: <endpoint name="ClientProxyEndPoint" address="http://localhost:8000/RafyServer/Text" 13: binding="basicHttpBinding" bindingConfiguration="basicHttpBindingConfig" 14: contract="Rafy.DataPortal.WCF.IWcfPortal" /> 15: </client> 16: <bindings> 17: <basicHttpBinding> 18: <binding name="basicHttpBindingConfig" receiveTimeout="00:20:00" sendTimeout="02:00:00" maxReceivedMessageSize="1000000000"> 19: <readerQuotas maxDepth="64" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="16384"/> 20: </binding> 21: </basicHttpBinding> 22: </bindings> 23: </system.serviceModel> 24: </configuration> 运行程序 先运行 ServerConsole,成功运行界面: 再运行 ClothesSys,点击登录。登录成功,即说明已经成功使用 C/S 进行部署。 代码下载 下载地址:http://pan.baidu.com/s/1AB9TL 本文的代码在“3.使用 CS 部署程序”文件夹中。 本文转自BloodyAngel博客园博客,原文链接:http://www.cnblogs.com/zgynhqf/p/3421517.html,如需转载请自行联系原作者

优秀的个人博客,低调大师

运维架构图之用前端简易实现集群框架图

前言: 今个群里有个哥们问我怎么实现一个集群的架构图,一说架构图,大家肯定想到的是用visio或者是亿图,但是动态的咋办?甚至说高端了点,不仅可以看到架构图,而且可以看到流量及负载的信息。 现在运维平台这么火热,大家恨不得把平台做全面点。 我以前做过一个机房展现图,有兴趣的朋友可以再以前的博客中找到。 运维平台化之IDC机柜拓扑及数据展现实现思路 http://rfyiamcool.blog.51cto.com/1030776/1346389 用的是 jquery.jOrgChart.css js库,实现提来还算简单。大家只需要做个模板,然后各种if判断就行了。你懂的。 个人觉得大家要在cmdb资产系统里面要做好位置的标记,不然后期做架构图展现的时候,会发现 没法动态。。。。。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 原文: < script src = "http://libs.baidu.com/jquery/1.9.0/jquery.js" ></ script > < script src = "http://libs.baidu.com/jqueryui/1.8.22/jquery-ui.min.js" ></ script > < script src = "jquery.jOrgChart.js" ></ script > < script > jQuery(document).ready(function(){ $("#org").jOrgChart({ chartElement:'#chart', dragAndDrop:true }); }); </ script > </ head > < body onload = "prettyPrint();" > < div class = "topbar" > < div class = "topbar-inner" > < div class = "container" > < a class = "brand" href = "#" >jQueryOrganisationChart</ a > < ul class = "nav" > < li >< a href = "http://github.com/wesnolte" >Github</ a ></ li > < li >< a href = "http://twitter.com/wesnolte" >Twitter</ a ></ li > < li >< a href = "http://th3silverlining.com" >Blog</ a ></ li > </ ul > < div class = "pull-right" > < div class = "alert-messageinfo" id = "show-list" >Showunderlyinglist.</ div > < pre class = "prettyprintlang-html" id = "list-html" style = "display:none" ></ pre > </ div > </ div > </ div > </ div > < ul id = "org" style = "display:none" > < li >< br >< font size = "4" >Balance</ font > < ul > < li id = "beer" >< br >redis192.168.1.10</ li > < li >< br >nginx2192.168.1.13 < ul > < li >mongodb192.168.1.16</ li > < li >mongodb192.168.1.19</ li > </ ul > </ li > < li class = "fruit" >nginx3192.168.1.24 < ul > < li >php192.168.1.28 < ul > < li >mysql192.168.1.33</ li > < li >mysql192.168.1.37</ li > </ ul > </ li > </ ul > </ li > < li >spider192.168.1.41</ li > < li class = "collapsed" >nginx5192.168.1.44 < ul > < li >Topdeck</ li > < li >Reese'sCups</ li > </ ul > </ li > </ ul > </ li > </ ul > < div id = "chart" class = "orgChart" ></ div > < script > jQuery(document).ready(function(){ /*CustomjQueryfortheexample*/ $("#show-list").click(function(e){ e.preventDefault(); $('#list-html').toggle('fast',function(){ if($(this).is(':visible')){ $('#show-list').text('Hideunderlyinglist.'); $(".topbar").fadeTo('fast',0.9); }else{ $('#show-list').text('Showunderlyinglist.'); $(".topbar").fadeTo('fast',1); } }); }); $('#list-html').text($('#org').html()); $("#org").bind("DOMSubtreeModified",function(){ $('#list-html').text(''); $('#list-html').text($('#org').html()); prettyPrint(); }); }); </ script > 这里实现的方法有些简单,大家自己举一反三的做成模板,也可以换成自己服务器的图标。 好了,不多说了 ! 本文转自 rfyiamcool 51CTO博客,原文链接:http://blog.51cto.com/rfyiamcool/1559137,如需转载请自行联系原作者

资源下载

更多资源
优质分享App

优质分享App

近一个月的开发和优化,本站点的第一个app全新上线。该app采用极致压缩,本体才4.36MB。系统里面做了大量数据访问、缓存优化。方便用户在手机上查看文章。后续会推出HarmonyOS的适配版本。

腾讯云软件源

腾讯云软件源

为解决软件依赖安装时官方源访问速度慢的问题,腾讯云为一些软件搭建了缓存服务。您可以通过使用腾讯云软件源站来提升依赖包的安装速度。为了方便用户自由搭建服务架构,目前腾讯云软件源站支持公网访问和内网访问。

Rocky Linux

Rocky Linux

Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。

Sublime Text

Sublime Text

Sublime Text具有漂亮的用户界面和强大的功能,例如代码缩略图,Python的插件,代码段等。还可自定义键绑定,菜单和工具栏。Sublime Text 的主要功能包括:拼写检查,书签,完整的 Python API , Goto 功能,即时项目切换,多选择,多窗口等等。Sublime Text 是一个跨平台的编辑器,同时支持Windows、Linux、Mac OS X等操作系统。

用户登录
用户注册
修改密码
忘记密码