我使用curl使用REST API进行基本认证:
curl -X POST -H 'Accept: application/json' -u user:password http://localhost/test/
Run Code Online (Sandbox Code Playgroud)
但是,当我尝试使用powershell webRequest时,我得到403(许可被拒绝).当我在REST代码中禁用身份验证检查时,此脚本正常工作.
powershell在POST请求上传递凭据的最佳方式是什么,类似于curl,或者我可以做些什么来修复以下脚本.
非常感谢对此的一些指导.谢谢.
这是我的powershell脚本:
function Execute-HTTPPostCommand() {
param(
[string] $target = $null
)
$username = "user"
$password = "pass"
$webRequest = [System.Net.WebRequest]::Create($target)
$webRequest.ContentType = "text/html"
$PostStr = [System.Text.Encoding]::UTF8.GetBytes($Post)
$webrequest.ContentLength = $PostStr.Length
$webRequest.ServicePoint.Expect100Continue = $false
$webRequest.Credentials = New-Object System.Net.NetworkCredential -ArgumentList $username, $password
$webRequest.PreAuthenticate = $true
$webRequest.Method = "POST"
$requestStream = $webRequest.GetRequestStream()
$requestStream.Write($PostStr, 0,$PostStr.length)
v$requestStream.Close()
[System.Net.WebResponse] $resp = $webRequest.GetResponse();
$rs = $resp.GetResponseStream();
[System.IO.StreamReader] $sr = New-Object System.IO.StreamReader -argumentList $rs;
[string] …
Run Code Online (Sandbox Code Playgroud) 我有一个非常大的CSV文件(8000多项)的URL,我正在阅读CSV数据集配置元素.它填充HTTP请求采样器的路径并使用while控制器进行迭代.
这很好,除了我想要的是让每个用户(线程)从CSV URL列表中选择一个随机URL.我不想要的是每个线程顺序使用CSV项目.
我能够通过带有多个HTTP请求采样器的随机顺序控制器来实现这一点,但是8000多个HTTP采样器确实将jmeter陷入了无法使用的状态.所以这就是我将HTTP Sampler URL放在CSV文件中的原因.但是,我似乎无法将随机顺序控制器与CSV文件数据一起使用.那么如何在每个线程中实现随机CSV数据项选择呢?
我们正在从CruiseControl.NET迁移到Jenkins,只是为了与合作伙伴保持同步,因此我们没有两个不同的CI脚本.我们正在尝试设置Jenkins做类似于我们CruiseControl所做的事情,它有一个集中的服务器调用远程构建机器上的项目(jenkins中的作业).
我们有多个与单个项目关联的构建机器,因此当我们从集中式CI服务器构建项目时,它将调用远程CI服务器上的项目.远程CI服务器将从集中式CI服务器项目中提取版本.
在CruiseCruise控件中,我们设置了一个可以forceBuild
在远程项目上执行的项目.构建机器上的项目使用a remoteProjectLabeller
来检索版本号,以便它们始终保持同步.
要检索主构建号:
<labeller type="remoteProjectLabeller">
<project>MainProject</project>
<serverUri>tcp://central-server:21234/CruiseManager.rem</serverUri>
</labeller>
Run Code Online (Sandbox Code Playgroud)
要调用远程项目:
<forcebuild>
<project>RemoteBuildMachineA</project>
<serverUri>tcp://remote-server:21234/CruiseManager.rem</serverUri>
<integrationStatus>Success</integrationStatus>
</forcebuild>
Run Code Online (Sandbox Code Playgroud)
到目前为止,在jenkins我使用java web start设置了一个辅助服务器作为奴隶,但我不知道如何让主jenkins调用奴隶上的项目设置.
我可以设置Jenkins来调用奴隶上的项目(作业)吗?
我可以让奴隶从主人那里取出版本号吗?
编辑 -
让我补充一些信息.
我们使用集成的Windows身份验证在虚拟目录中设置了一些Web内容.虚拟目录在使用自定义标识(自定义用户帐户)的应用程序池下运行.问题是NTLM身份验证有效,但Kerberos身份验证不起作用.这是在IIS 6下工作的相同配置,但我们需要迁移到IIS 7并且Kerberos身份验证不起作用.
以下是有关我的环境的更多信息:
虚拟目录验证设置:
应用池设置:
Web.config设置:
虚拟目录权限:
OS设置:
以下是我从fiddler比较IIS 6到IIS 7的分析.在IIS 6中,Kerberos身份验证工作正常,应用程序池运行自定义标识.
小提琴手:
(使用domain\user)
请求1(无身份验证)
No Proxy-Authorization Header is present.
No Authorization Header is present.
Run Code Online (Sandbox Code Playgroud)
回复1(401)(挑战)
No Proxy-Authenticate Header is present.
WWW-Authenticate Header is present: Negotiate
WWW-Authenticate Header is present: NTLM
Run Code Online (Sandbox Code Playgroud)
请求2(Kerberos票证)
Authorization Header (Negotiate) appears to contain a Kerberos ticket:
<data>
Run Code Online (Sandbox Code Playgroud)
回复2(401)(Kerberos回复)
WWW-Authenticate Header (Negotiate) …
Run Code Online (Sandbox Code Playgroud) 我在Windows上运行Tomcat 6,并且希望Tomcat使用除cacerts之外的其他信任存储来进行Java客户端Web请求.我尝试添加此设置:
-Djavax.net.ssl.trustStore="C:\ca.keystore"
Run Code Online (Sandbox Code Playgroud)
到密钥注册表:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Apache Software Foundation\Procrun 2.0\Tomcat6\Parameters\Java
Run Code Online (Sandbox Code Playgroud)
但这似乎不起作用.它仍然使用JRE cacerts商店.我们的Java代码向HTTPS端点发出Web请求,并且我希望将证书保存在除JRE之外的密钥存储区中,因为在卸载/更新Java时它会被删除.
我有两个带有数据的文本文件.
第一个文本文件包含我的文件的完整路径的大列表.d:\猫\ cat1.txt
d:\test\file1-1.txt
d:\test\file1-2.txt
....
d:\test\file1-N.txt
Run Code Online (Sandbox Code Playgroud)
第二个文本文件包含my\files的完整路径的简短列表
d:\猫\文件\ cat2.txt
d:\test\file2-1.txt
d:\test\file2-2.txt
Run Code Online (Sandbox Code Playgroud)
我需要包含的第三个文件
d:\test\file1-1.txt
d:\test\file1-2.txt
d:\test\file2-1.txt
d:\test\file1-3.txt
d:\test\file1-4.txt
d:\test\file2-2.txt
d:\test\file1-5.txt
d:\test\file1-6.txt
d:\test\file2-1.txt
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助.
当我使用powershell和set-acl设置新的filesystemaccess规则时,我将继承标志设置为传播给子对象和叶对象
$acl.AddAccessRule((New-Object System.Security.AccessControl.FileSystemAccessRule(
"username","FullControl", "ContainerInherit, ObjectInherit", "None", "Allow")))
Set-Acl -path $filename -aclObject $acl
Run Code Online (Sandbox Code Playgroud)
当我在安全选项卡中查看资源管理器中的权限..高级..传播设置正确.但如果我亲眼看看孩子,他们就不会显示新的安全规则.
如果在资源管理器中,我添加另一个具有不同SID的规则..并保存它(不强制选项'替换所有子对象权限...').然后手册和powershell规则都显示在孩子身上.它似乎需要某种启动才能让孩子们接受新的传播规则.为了使子对象显示添加了新规则,我缺少什么?
这给我一个短路径(DOS约定)(在Windows上):
import tempfile
tempDir = tempfile.mkdtemp()
print tempDir
Output >>> c:\users\admini~1\appdata\local\temp\tmpf76unv
Run Code Online (Sandbox Code Playgroud)
请注意admini~1
.
如何将其转换为完整路径?例如C:\ users\administrator\appdata ...
我正在从这个教程网站上学习haskell .正如您所看到的,图片中的控制台具有颜色,使写入更容易,更易读.有没有办法让ghci在窗户上变得丰富多彩.
我问这个是因为IDLE在使用Python时有颜色,这使得它更易于使用.
我见过的名称空间不可知语法令我困惑.
说我有:
<root>
<parent attribute="A">A<child>A</child></parent>
<parent attribute="B">B<child>B</child></parent>
</root>
Run Code Online (Sandbox Code Playgroud)
到目前为止,我看到如何:
/root/parent/child/text()
Run Code Online (Sandbox Code Playgroud)
翻译为:
/*[local-name()='root']/*[local-name()='parent']/*[local-name()='child']/text()
Run Code Online (Sandbox Code Playgroud)
但我正在努力做这样的事情:
/root/parent[@attribute="A"]/child/text()
Run Code Online (Sandbox Code Playgroud)
要么:
/root/parent[text()="B"]/child/text()
Run Code Online (Sandbox Code Playgroud)
要么:
/root/parent[1]/child/text()
Run Code Online (Sandbox Code Playgroud)
这些翻译怎么样?
谢谢,
编辑:再一次:-)
<root>
<parent>
<childName>serverName</childName>
<childValue>MyServer</childValue>
</parent>
<parent>
<childName>ServerLocation</childName>
<childValue>Somewhere</childValue>
</parent>
</root>
Run Code Online (Sandbox Code Playgroud)
这是如何翻译的?
/root/parent[childName="serverName"]/childValue/text()
Run Code Online (Sandbox Code Playgroud)