PowerShell远程调用神秘地挂起(PowerShell remote invocation mysteriously hangs)
我已经创建了一系列基本上收集有关站点的所有IIS配置的函数,当在本地服务器上运行它没有问题时执行(虽然很慢)但是当我在PowerShell 2中使用
invoke-command
远程运行它时它会运行并且神秘地停止大约15-20秒进入该过程。 它通常会在同一个请求中停止,但并非总是如此。 在本地执行的相同命令没有任何问题。 没有例外,它只是无限期挂起。我可以在必要时发布代码,但它是几百行,所以我更关注如何调查这样的问题,或者是否有人遇到过类似的问题。
Comparing IISConfig between [targetserver] and localhost. Checking Installed IIS version on [targetserver]: IIS major version : 7 IIS minor version : 5 IIS7+ detected, using WebAdmin module and IIS metabase Name Value ---- ----- name Default Web Site id 1 serverAutoStart True state 1 Site Configuration: Name Path PSPath Handlers_Ac Access_sslF Asp_AppAllo Asp_AppAllo Asp_limits_ Asp_EnableP Asp_limits_ cessFlags lags wClientDebu wDebugging bufferingLi arentPaths queueTimeou g mit t ---- ---- ------ ----------- ----------- ----------- ----------- ----------- ----------- ----------- Default ... IIS:Site... WebAdmin... Read,Script False False 25000000 True 00:00:00 WebApp VDir: /MyApp, App Pool: MyApp App pool Configuration: AppPoolID Enable32Bit managedPipe managedRunt AppPoolName AppPoolAuto processMode processMode processMode recycling_l AppOnWin64 lineMode imeVersion Start l_idleTimeo l_identityT l_UserName ogEventOnRe ut ype cycle --------- ----------- ----------- ----------- ----------- ----------- ----------- ----------- ----------- ----------- False Classic v2.0 MyApp True 00:20:00 LocalSer... Time,Req... Analyzing web directories for /MyApp, this could take a while.... Initial Collection Completed, found 141... took 0.9516122 seconds 0 C:\inetpub\wwwroot\MyApp\Core 1 C:\inetpub\wwwroot\MyApp\Core\AdminTools 2 C:\inetpub\wwwroot\MyApp\Core\AdminTools\Cache 3 C:\inetpub\wwwroot\MyApp\Core\AdminTools\Extra 4 C:\inetpub\wwwroot\MyApp\Core\AdminTools\HTTPPostTest 5 C:\inetpub\wwwroot\MyApp\Core\AdminTools\IISAdmin 6 C:\inetpub\wwwroot\MyApp\Core\AdminTools\Profiling 7 C:\inetpub\wwwroot\MyApp\Core\AdminTools\RecordTestData 8 C:\inetpub\wwwroot\MyApp\Core\AdminTools\ScrambleTest 9 C:\inetpub\wwwroot\MyApp\Core\AdminTools\Sessions Analyzed 10 so far... took 6.7236862 seconds, remaining time 88.08028922 seconds Current Folder: C:\inetpub\wwwroot\MyApp\Core\AdminTools\Sessions 10 C:\inetpub\wwwroot\MyApp\Core\AdminTools\SoapTest 11 C:\inetpub\wwwroot\MyApp\Core\AdminTools\StaticContent
有时它会达到15左右。 我尝试从我的笔记本电脑和从一台服务器到另一台服务器,行为是一样的。
这是挂起的循环:
$start = [System.DateTime]::Now $numanalyzed = 0 if ($true) #skip to test { # loop through all physical folders as it is much faster foreach ($folder in $folders) { write-host $numanalyzed $folder.fullname #figure out the virtual path to the folder $iis7vwebfolderpath = $folder.FullName.Replace($iis7webapp.PhysicalPath, $iis7VDirWebApppath) #Get-item $iis7vwebfolderpath | gm $iis7VWebDirConfigItem = Get-LNOSIIS7ConfigForPSPath -PSPath $iis7vwebfolderpath # add new item to list $iis7VWebDirConfig += $iis7VWebDirConfigItem # increment counter and report out progress every 10 $numAnalyzed++ if ($numanalyzed % 10 -eq 0) { $end = [System.DateTime]::Now $timeSoFar = (NEW-TIMESPAN –Start $Start –End $End).TotalSeconds $timeremaining = ($folders.Count - $numAnalyzed) * ($timeSoFar / $numanalyzed) "Analyzed {0} so far... took {1} seconds, remaining time {2} seconds" -f $numanalyzed,$timeSoFar,$timeremaining | write-host "Current Folder: {0}" -f $folder.FullName | Write-Host } } } $end = [System.DateTime]::Now "Processed web dirs: {0} took {1} seconds" -f $iis7VWebDirConfig.Count,(NEW-TIMESPAN –Start $Start –End $End).TotalSeconds | write-host | Write-Host
函数我遇到了性能问题,我有一个单独的问题,但这篇文章有该函数的源代码:
I have created a series of functions that basically collect all the IIS configurations about a site, when run on a server locally it executes without issue (albeit slowly) however when I run them remotely using an
invoke-command
in PowerShell 2 it runs through and mysteriously stops approximately 15-20 seconds into the process. It generally stalls on the same request but not always. The same commands executed locally work without any issues. No exception is raised, it just hangs indefinitely.I can post the code if necessary however it is several hundred lines so I'm more looking for guidance on how to investigate a problem like this or if anyone has encountered something similar.
Comparing IISConfig between [targetserver] and localhost. Checking Installed IIS version on [targetserver]: IIS major version : 7 IIS minor version : 5 IIS7+ detected, using WebAdmin module and IIS metabase Name Value ---- ----- name Default Web Site id 1 serverAutoStart True state 1 Site Configuration: Name Path PSPath Handlers_Ac Access_sslF Asp_AppAllo Asp_AppAllo Asp_limits_ Asp_EnableP Asp_limits_ cessFlags lags wClientDebu wDebugging bufferingLi arentPaths queueTimeou g mit t ---- ---- ------ ----------- ----------- ----------- ----------- ----------- ----------- ----------- Default ... IIS:Site... WebAdmin... Read,Script False False 25000000 True 00:00:00 WebApp VDir: /MyApp, App Pool: MyApp App pool Configuration: AppPoolID Enable32Bit managedPipe managedRunt AppPoolName AppPoolAuto processMode processMode processMode recycling_l AppOnWin64 lineMode imeVersion Start l_idleTimeo l_identityT l_UserName ogEventOnRe ut ype cycle --------- ----------- ----------- ----------- ----------- ----------- ----------- ----------- ----------- ----------- False Classic v2.0 MyApp True 00:20:00 LocalSer... Time,Req... Analyzing web directories for /MyApp, this could take a while.... Initial Collection Completed, found 141... took 0.9516122 seconds 0 C:\inetpub\wwwroot\MyApp\Core 1 C:\inetpub\wwwroot\MyApp\Core\AdminTools 2 C:\inetpub\wwwroot\MyApp\Core\AdminTools\Cache 3 C:\inetpub\wwwroot\MyApp\Core\AdminTools\Extra 4 C:\inetpub\wwwroot\MyApp\Core\AdminTools\HTTPPostTest 5 C:\inetpub\wwwroot\MyApp\Core\AdminTools\IISAdmin 6 C:\inetpub\wwwroot\MyApp\Core\AdminTools\Profiling 7 C:\inetpub\wwwroot\MyApp\Core\AdminTools\RecordTestData 8 C:\inetpub\wwwroot\MyApp\Core\AdminTools\ScrambleTest 9 C:\inetpub\wwwroot\MyApp\Core\AdminTools\Sessions Analyzed 10 so far... took 6.7236862 seconds, remaining time 88.08028922 seconds Current Folder: C:\inetpub\wwwroot\MyApp\Core\AdminTools\Sessions 10 C:\inetpub\wwwroot\MyApp\Core\AdminTools\SoapTest 11 C:\inetpub\wwwroot\MyApp\Core\AdminTools\StaticContent
Sometimes it makes it to 15 or so. I tried from my laptop and from one server to another and the behavior is the same.
Here is the loop which is hanging:
$start = [System.DateTime]::Now $numanalyzed = 0 if ($true) #skip to test { # loop through all physical folders as it is much faster foreach ($folder in $folders) { write-host $numanalyzed $folder.fullname #figure out the virtual path to the folder $iis7vwebfolderpath = $folder.FullName.Replace($iis7webapp.PhysicalPath, $iis7VDirWebApppath) #Get-item $iis7vwebfolderpath | gm $iis7VWebDirConfigItem = Get-LNOSIIS7ConfigForPSPath -PSPath $iis7vwebfolderpath # add new item to list $iis7VWebDirConfig += $iis7VWebDirConfigItem # increment counter and report out progress every 10 $numAnalyzed++ if ($numanalyzed % 10 -eq 0) { $end = [System.DateTime]::Now $timeSoFar = (NEW-TIMESPAN –Start $Start –End $End).TotalSeconds $timeremaining = ($folders.Count - $numAnalyzed) * ($timeSoFar / $numanalyzed) "Analyzed {0} so far... took {1} seconds, remaining time {2} seconds" -f $numanalyzed,$timeSoFar,$timeremaining | write-host "Current Folder: {0}" -f $folder.FullName | Write-Host } } } $end = [System.DateTime]::Now "Processed web dirs: {0} took {1} seconds" -f $iis7VWebDirConfig.Count,(NEW-TIMESPAN –Start $Start –End $End).TotalSeconds | write-host | Write-Host
The function I'm having performance problems with and I've got a separate question about but this post has the source code for the function:
web-administration vs WMI to query web directory properties performance problems
原文:https://stackoverflow.com/questions/29638446
最满意答案
我已经更正了您的代码,请在下方查看,我希望它对您有用。
<div class="item active"> <?php $data= $this->main->viewbook(); $r=1; foreach ($data as $row){ if($r%6==0) { echo '</div><div class="item">'; } ?> <div class="col-lg-2 col-xs-6 col-md-4 col-sm-6 thumbnails"> <div class="fff"> <a href="#"><img class="img-responsive" src="<?php echo base_url()?>assets/images/css.jpg" alt=""></a> <strong>Praesent commodo Nibh Etiam Sem Nullam</strong><br> <strong style=" color:#029f5b;"> <?php echo $row->BookID; ;?></strong><br> Nullam Condimentum Nibh Etiam Sem no inquiry so cordial <a class="" href="#">» Read More</a> </div> </div> <?php $r++; } ?> </div>
I have corrected your code, check it below and i hope it will work for you.
<div class="item active"> <?php $data= $this->main->viewbook(); $r=1; foreach ($data as $row){ if($r%6==0) { echo '</div><div class="item">'; } ?> <div class="col-lg-2 col-xs-6 col-md-4 col-sm-6 thumbnails"> <div class="fff"> <a href="#"><img class="img-responsive" src="<?php echo base_url()?>assets/images/css.jpg" alt=""></a> <strong>Praesent commodo Nibh Etiam Sem Nullam</strong><br> <strong style=" color:#029f5b;"> <?php echo $row->BookID; ;?></strong><br> Nullam Condimentum Nibh Etiam Sem no inquiry so cordial <a class="" href="#">» Read More</a> </div> </div> <?php $r++; } ?> </div>
相关问答
更多-
帮助foreach循环(help with foreach loop)[2023-04-24]
您在此处的查询中选择它: SELECT node.name, (COUNT(parent.name) - 1) AS depth 因此,在您的foreach中,您需要检查所需的密钥,或检查您不想要的密钥。 foreach($iterator as $key=>$value) { if ($key != 'name') { continue; } echo $key.' -- '.$value.'
'; } 作为后者的一个例子。 如果你想要 ... -
在php中的bootstrap模型中显示foreach循环变量值(Display foreach loop variable value in bootstrap model in php)[2022-07-03]
所以我提供的概述代码,您可能需要编辑以满足您的确切需求... // Append a unique data-target to every anchor // I assume the $service has id attribute对于数据集中的每个项目,您要添加具有相同ID的下拉列表。 元素ID必须是唯一的,我只需要关闭id并选择一个类。 您还需要更改jQuery单击处理程序。 $('ul.color-chooser > li > a').click(function(e) { e.preventDefault(); var $this = $(this); // get the chooser button var colorChooser = $this.closest('div.bt ...首先,让我们从将图像分组为三的倍数开始。 // An arbitrary list of image file names (used for clarity). $images = ['image-1.jpg', 'image-2.jpg', 'image-3.jpg', 'image-4.jpg', 'image-5.jpg', 'image-6.jpg', 'image-7.jpg', 'image-8.jpg', 'image-9.jpg']; // Separate images into gr ...由于两个数据库是分开的,因此您有两种选择: 在循环并生成HTML之前确定部件号,然后使用IN子句同时查询所有部件: SELECT ... WHERE PartNumber IN (1, 2, 3, 4); 首次调用getPartQuantityOnHand时,选择零件的所有库存水平并存储: public function getPartQuantityOnHand($partNum) { if(!$this->partQuantitiesOnHand) { $conn = $thi ...看起来他们在演示中使用了以下引导程序样式表: http://www.tutorialrepublic.com/examples/css/bootstrap.min.css 通过将其替换为小提琴中的那个,您可以获得正确的程式化代码。 的jsfiddle 专家提示: 如果您想知道某些内容是如何呈现的,只需使用Inspect Element ,它将为您提供如下内容: 从那里,您可以切换每个属性,以查看它们如何影响显示的实时演示。 你可以复制css并把它扔进你自己的小提琴里。 或者您甚至可以查看每个部分的右上角以查 ...在php foreach循环bootstrap Carousel每次显示6个产品(In php foreach loop bootstrap Carousel display 6 product each time)[2022-02-08]
我已经更正了您的代码,请在下方查看,我希望它对您有用。main->viewbook(); $r=1; foreach ($data as $row){ if($r%6==0) { echo ''; } ?>通常,我会制作一些怪异的SQL查询,将查询分组并返回所需的行,并将其周期总和追加到最后。 作为一个更容易的修复,但你应该能够使用下面的代码来跳过没有时间的时段。 我用一个简单的数组对它进行了测试,但它可能(或可能不)需要一些调整来与你的工作。 $hoursForPeriod = array_reduce($rows, function($carry, $elem) use ($dt, $d2) { $startday = date('Y-m-d', strtotime($elem['start']) ...PHP foreach循环帮助(PHP foreach loop help)[2024-02-23]
在循环顶部插入(粗略概念,可能需要进行一些修改以适合您的代码): if ($currentItem % 4 == 0) { // every fourth item $randIndex = array_rand($usp); // pick random index from $usp $randUsp = $usp[$randIndex]; // code to display $randUsp // and display it in the table ...你的项目中有一个div,包含类行和类col-md-12,但是列需要在一行内,这可能会有所帮助 尝试这个 :相关文章
更多- Hadoop源码分析之RPC(Remote Procedure Call Protocol)
- 远程调试Hadoop
- 多人协作-git入门教程
- laughing教你mysql远程连接
- 从远程库克隆-git入门教程
- 添加远程库-git入门教程
- 远程监控JVM--VisualVM
- Hadoop系列-IPC之代码实现
- jquery validate注册校验实例
- Hadoop RPC机制&完整调用流程
最新问答
更多- 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
- 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
- OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
- 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
- codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
- 在计算机拍照在哪里进入
- 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
- No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
- 单页应用程序:页面重新加载(Single Page Application: page reload)
- 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
- System.StackOverflow错误(System.StackOverflow error)
- KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
- 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
- android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
- TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
- 企业安全培训的各项内容
- 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
- C#类名中允许哪些字符?(What characters are allowed in C# class name?)
- NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
- 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
- 将多个行和可变行移动到列(moving multiple and variable rows to columns)
- 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
- 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
- Angular $资源不会改变方法(Angular $resource doesn't change method)
- 在Angular 5中不是一个函数(is not a function in Angular 5)
- 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
- 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
- 常见的python rpc和cli接口(Common python rpc and cli interface)
- Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
- 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)