我的位置:速网百科 > 电商资讯 服务器

如何获取服务器代码实现,怎么获取服务器

作者:江和泽 时间:2022-05-20 15:11:19

迁移git服务器 开发人员怎么获取代码

迁移git服务器 开发人员怎么获取代码

  有一个项目一直是再我们localhost服务器A下使用的git做的开发。最近需要搬移到线上的服务器B上。
  目的:要保留原有的所有的开发记录。
  一开始,我准备是直接clone一份最新的,然后以这个为原始版本开创建,发现这个是不可取的。
  最后想到的一个办法就是,登陆到A上面,切换到git用户组,使用scp将整个repositories下的项目目录copy到服务器B的git repositories下。那样就能保留原有的文件所有者规git所有。然后在服务器B上创建一个跟刚才copy过去的项目。就可以直接在本地使用B服务器上的git地址进行开发了。
  如果您是使用的别人的git仓库,比如github。那就看看下面这篇我在网上找的文章:
  如果你想从别的 Git 托管服务那里复制一份源代码到新的 Git 托管服务器上的话,可以通过以下步骤来操作。
  1). 从原地址克隆一份裸版本库,比如原本托管于 GitCafe。
   git clone –bare git@gitcafe.com:username/project.git
  2). 然后到新的 Git 服务器上创建一个新项目,比如 GitHub。
  3). 以镜像推送的方式上传代码到 GitHub 服务器上。
   cd project.git
   git push –mirror git@github.com:username/newproject.git
  4). 删除本地代码
   cd ..
   rm -rf project.git
  5). 到新服务器 GitCafe 上找到 Clone 地址,直接 Clone 到本地就可以了。
   git clone git@github.com:username/newproject.git
  这种方式可以保留原版本库中的所有内容。

  

vs2010怎么从服务器上获取最新代码

  1、要调试服务器端的代码,先把服务器端的dll换为最新的。

  2、debug---attch process

   A、附加主调试进程(eg:Tr管理软件套件)

   B、附加W3WP.exe进程(该进程仅在服务器端有,客户端没有),调试服务器端代码的关键。

  在XP中该进程不叫W3wp.exe,而叫做

  3、在服务器端代码添加断点,即可追逐到服务器端的代码

  小注:要调试哪部分代码,就在哪里添加断点。

ASP获取服务器及本地信息 代码如何编写

ASP获取服务器及本地信息 代码如何编写

  <html>
  <head>
  <link href="../css.css" rel="stylesheet" type="text/css">
  </head>
  <body>
  <table width="50%" border="0" align="center" cellpadding="0" cellspacing="0" >
  <tr>
  <td>
  <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#336699">
  <tr bgcolor="" align="center">
  <td height="20" colspan="2" class="htd" ><font color="#FFFFFF"><b>服 务 器 的 配 置</b></font></td>
  </tr>
  <tr>
  <td width="40%" align="center" bgcolor="#336699" class="htd"><font color="#FFFFFF">检取ISAPIDLL的metabase路径</font></td>
  <td align="center" bgcolor="#3366CC" class="htd"><font color="#FFf000"><%=Request.ServerVariables("APPL_MD_PATH")%></font></td>
  </tr>
  <tr>
  <td width="40%" align="center" bgcolor="#336699" class="htd"><font color="#FFFFFF">路径信息</font></td>
  <td align="center" bgcolor="#3366CC" class="htd"><font color="#FFf000"><%=Request.ServerVariables("PATH_INFO")%></font></td>
  </tr>
  <tr>
  <td width="40%" align="center" bgcolor="#336699" class="htd"><font color="#FFFFFF">服务器IP地址</font></td>
  <td align="center" bgcolor="#3366CC" class="htd"><font color="#FFf000"><%=Request.ServerVariables("LOCAL_ADDR")%></font></td>
  </tr>
  <tr>
  <td width="40%" align="center" bgcolor="#336699" class="htd"><font color="#FFFFFF">显示执行SCRIPT的虚拟路径</font></td>
  <td align="center" bgcolor="#3366CC" class="htd"><font color="#FFf000"><%=Request.ServerVariables("SCRIPT_NAME")%></font></td>
  </tr>
  <tr>
  <td width="40%" align="center" bgcolor="#336699" class="htd"><font color="#FFFFFF">返回服务器的主机名,DNS别名,或IP地址</font></td>
  <td align="center" bgcolor="#3366CC" class="htd"><font color="#FFf000"><%=Request.ServerVariables("SERVER_NAME")%></font></td>
  </tr>
  <tr>
  <td width="40%" align="center" bgcolor="#336699" class="htd"><font color="#FFFFFF">返回服务器处理请求的端口</font></td>
  <td align="center" bgcolor="#3366CC" class="htd"><font color="#FFf000"><%=Request.ServerVariables("SERVER_PORT")%></font></td>
  </tr>
  <tr>
  <td width="40%" align="center" bgcolor="#336699" class="htd"><font color="#FFFFFF">协议的名称和版本</font></td>
  <td align="center" bgcolor="#3366CC" class="htd"><font color="#FFf000"><%=Request.ServerVariables("SERVER_PROTOCOL")%></font></td>
  </tr>
  <tr>
  <td width="40%" align="center" bgcolor="#336699" class="htd"><font color="#FFFFFF">服务器的名称和版本</font></td>
  <td align="center" bgcolor="#3366CC" class="htd"><font color="#FFf000"><%=Request.ServerVariables("SERVER_SOFTWARE")%></font></td>
  </tr>
  <tr>
  <td width="40%" align="center" bgcolor="#336699" class="htd"><font color="#FFFFFF">服务器操作系统内核</font></td>
  <td align="center" bgcolor="#3366CC" class="htd"><font color="#FFf000"><%=Request.ServerVariables("OS")%></font></td>
  </tr>
  <tr>
  <td width="40%" align="center" bgcolor="#336699" class="htd"><font color="#FFFFFF">脚本超时时间</font></td>
  <td align="center" bgcolor="#3366CC" class="htd"><font color="#FFf000"><%=Server.ScriptTimeout%> 秒</font></td>
  </tr>
  <tr>
  <td width="40%" align="center" bgcolor="#336699" class="htd"><font color="#FFFFFF">服务器CPU数量</font></td>
  <td align="center" bgcolor="#3366CC" class="htd"><font color="#FFf000"><%=Request.ServerVariables("NUMBER_OF_PROCESSORS")%> 个</font></td>
  </tr>
  <tr>
  <td width="40%" align="center" bgcolor="#336699" class="htd"><font color="#FFFFFF">服务器解译引擎</font></td>
  <td align="center" bgcolor="#3366CC" class="htd"><font color="#FFf000"><%=ScriptEngine & "/"& ScriptEngineMajorVersion &"."&ScriptEngineMinorVersion&"."& ScriptEngineBuildVersion %></font></td>
  </tr>
  </table>
  <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" >
  <tr>
  <td height="20" colspan="2" align="center">
  </td>
  </tr>
  <tr>
  <td height="20" colspan="2" class="htd" align="center" bgcolor="#336699">
  <font color="#FFFFFF"><b>浏 览 器 信 息</b></font>
  </td>
  </tr>
  <tr>
  <td height="20" colspan="2" align="center" bgcolor="#336699">
  <%set browscap=server.createobject("mswc.browsertype")%>
  <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" >
  <tr><td width="40%" align="center" class="htd"><font color="#FFFFFF">浏览器类型</font></td>
  <td align="center" bgcolor="#3366CC" class="htd"><font color="#FFf000"><%=browscap.browser%></font></td></tr>
  <tr><td width="40%" align="center" class="htd"><font color="#FFFFFF">浏览器版本</font></td>
  <td align="center" bgcolor="#3366CC" class="htd"><font color="#FFf000"><%=browscap.version%></font></td></tr>
  <tr><td width="40%" align="center" class="htd"><font color="#FFFFFF">是否支持表格</font></td>
  <td align="center" bgcolor="#3366CC" class="htd"><font color="#FFf000"><%=browscap.tables%></font></td></tr>
  <tr><td width="40%" align="center" class="htd"><font color="#FFFFFF">是否支持ActiveX控件</font></td>
  <td align="center" bgcolor="#3366CC" class="htd"><font color="#FFf000"><%=browscap.activexcontrols%></font></td></tr>
  <tr><td width="40%" align="center" class="htd"><font color="#FFFFFF">是否支持JavaApplets</font></td>
  <td align="center" bgcolor="#3366CC" class="htd"><font color="#FFf000"><%=browscap.javaapplets%></font></td></tr>
  <tr><td width="40%" align="center" class="htd"><font color="#FFFFFF">是否支持Javascript</font></td>
  <td align="center" bgcolor="#3366CC" class="htd"><font color="#FFf000"><%=browscap.javascript%></font></td></tr>
  <tr><td width="40%" align="center" class="htd"><font color="#FFFFFF">是否支持Cookies</font></td>
  <td align="center" bgcolor="#3366CC" class="htd"><font color="#FFf000"><%=browscap.cookies%></font></td></tr>
  <tr><td width="40%" align="center" class="htd"><font color="#FFFFFF">是否支持框架</font></td>
  <td align="center" bgcolor="#3366CC" class="htd"><font color="#FFf000"><%=browscap.frames%></font></td></tr>
  <tr><td width="40%" align="center" class="htd"><font color="#FFFFFF">是否支持VBScript</font></td>
  <td align="center" bgcolor="#3366CC" class="htd"><font color="#FFf000"><%=browscap.vbscript%></font></td></tr>
  </table>
  <%set browscap=nothing%>
  </td>
  </tr>
  </table>
  <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" >
  <tr>
  <td height="20" colspan="2" align="center">
  </td>
  </tr>
  <tr>
  <td height="20" colspan="2" class="htd" align="center" bgcolor="#336699">
  <font color="#FFFFFF"><b>磁 盘 驱 动 器 信 息</b></font>
  </td>
  </tr>
  <tr>
  <td height="20" colspan="2" >
  <%
  function tran(driver)
  select case driver
  case 0:tran="设备无法识别"
  case 1:tran="软盘驱动器"
  case 2:tran="硬盘驱动器"
  case 3:tran="网络硬盘驱动器"
  case 4:tran="光盘驱动器"
  case 5:tran="RAM虚拟磁盘"
  end select
  end function
  set fso=server.createobject("scripting.filesystemobject")
  %>
  <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#336699">
  <tr><td class="htd" align="center"><font color="#FFFFFF">盘符</font></td><td class="htd" align="center"><font color="#FFFFFF">类型</font></td><td class="htd" align="center"><font color="#FFFFFF">卷标</font></td>
  <td class="htd" align="center"><font color="#FFFFFF" >总计大小</font></td><td class="htd" align="center"><font color="#FFFFFF">可用空间</font></td><td class="htd" align="center"><font color="#FFFFFF">文件系统</font></td>
  <td class="htd" align="center"><font color="#FFFFFF">序列号</font></td><td class="htd" align="center"><font color="#FFFFFF">是否可用</font></td><td class="htd" align="center"><font color="#FFFFFF">路径</font></td>
  </tr>
  <%
  for each drv in fso.drives
  response.write"<tr>"
  response.write"<td class=htd align=center bgcolor=#3366CC><font color=#FFf000>" & drv.driveletter &"</font></td>"
  response.write"<td class=htd align=center bgcolor=#3366CC><font color=#FFf000>" & tran(drv.drivetype) &"</font></td>"
  response.write"<td class=htd align=center bgcolor=#3366CC><font color=#FFf000>" & drv.volumename &"</font></td>"
  response.write"<td class=htd align=center bgcolor=#3366CC><font color=#FFf000>" & formatnumber(drv.totalsize/1024,0) &"</font></td>"
  response.write"<td class=htd align=center bgcolor=#3366CC><font color=#FFf000>" & formatnumber(drv.availablespace/1024,0) &"</font></td>"
  response.write"<td class=htd align=center bgcolor=#3366CC><font color=#FFf000>" & drv.filesystem &"</font></td>"
  response.write"<td class=htd align=center bgcolor=#3366CC><font color=#FFf000>" & drv.serialnumber &"</font></td>"
  response.write"<td class=htd align=center bgcolor=#3366CC><font color=#FFf000>" & drv.isready &"</font></td>"
  response.write"<td class=htd align=center bgcolor=#3366CC><font color=#FFf000>" & drv.path &"</font></td>"
  next
  %>
  </table>
  </td>
  </tr>
  </table>
  </td>
  </tr>
  </table>
  </body>
  </html>

用C#获取服务器路径,需要完整的代码例子。

  1、取得控制台应用程序的根目录方法
   方法1、Environment.CurrentDirectory 取得或设置当前工作目录的完整限定路径
   方法2、AppDomain.CurrentDomain.BaseDirectory 获取基目录,它由程序集冲突解决程序用来探测程序集
   2、取得Web应用程序的根目录方法
   方法1、HttpRuntime.AppDomainAppPath.ToString();//获取承载在当前应用程序域中的应用程序的应用程序目录的物理驱动器路径。用于App_Data中获取
   方法2、Server.MapPath("") 或者 Server.MapPath("~/");//返回与Web服务器上的指定的虚拟路径相对的物理文件路径
   方法3、Request.ApplicationPath;//获取服务器上ASP.NET应用程序的虚拟应用程序根目录
   3、取得WinForm应用程序的根目录方法
   1、Environment.CurrentDirectory.ToString();//获取或设置当前工作目录的完全限定路径
   2、Application.StartupPath.ToString();//获取启动了应用程序的可执行文件的路径,不包括可执行文件的名称
   3、Directory.GetCurrentDirectory();//获取应用程序的当前工作目录
   4、AppDomain.CurrentDomain.BaseDirectory;//获取基目录,它由程序集冲突解决程序用来探测程序集
   5、AppDomain.CurrentDomain.SetupInformation.ApplicationBase;//获取或设置包含该应用程序的目录的名称
  其中:以下两个方法可以获取执行文件名称
   1、Process.GetCurrentProcess().MainModule.FileName;//可获得当前执行的exe的文件名。
   2、Application.ExecutablePath;//获取启动了应用程序的可执行文件的路径,包括可执行文件的名称 追问 有没有完整的例子??

版权声明:本文由互联网用户自发贡献,仅代表作者观点。若文章违规或侵权,请 (举报反馈) ,核实后立即删除。