我正在使用一个应用程序,该应用程序当前已设置为发送http请求以删除在winform应用程序上按下按钮时创建的skytap虚拟机。但是,我获得了配置ID,但不确定为什么我的请求没有通过。
private void BtnCancelTest_Click(object sender, EventArgs e)
{
ConfigStatus configStatus;
Guid testRunId;
if (lvTestRunInfo.SelectedItems.Count > 0)
{
configStatus = (ConfigStatus)lvTestRunInfo.SelectedItems[0].Tag;
testRunId = (Guid)lvTestRunInfo.Tag;
if (configStatus.SkytapConfigId == 0)
{
Cursor.Current = Cursors.WaitCursor;
try
{
ConfigStatus newConfigStatus = mAutoTestManager.GetConfigStatus(testRunId, configStatus.Id);
configStatus.SkytapConfigId = newConfigStatus.SkytapConfigId;
}
finally
{
Cursor.Current = Cursors.Default;
}
if (configStatus.SkytapConfigId == 0)
{
MessageBox.Show("Configuration has not been created yet.");
return;
}
}
System.Net.HttpWebRequest request = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(@"https://cloud.skytap.com/configurations/" + configStatus.SkytapConfigId);
request.Method = "DELETE";`
单击按钮不会删除VM,但是,如果我太早单击应用程序中的“取消测试”按钮,我会收到消息“尚未创建配置”,这意味着它实际上是在存储VM ID,并且我的API调用有问题。