Invoke-RestMethod:{“消息”:“发生错误。”}

时间:2019-04-20 09:01:41

标签: powershell iis asp.net-web-api

如果调用了IIS上托管的API,则会发生以下错误

  

Invoke-RestMethod:{“消息”:“发生错误。”}   C:\ TFS \ Releases \ Current \ SLSAutomation \ TestProject1 \ PowerShellScripts \ Untitled1.ps1:536   字符:30   + ... response1 = Invoke-RestMethod“ http://10.63.22.36:81/api/e10/e10PostT ...   + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~       + CategoryInfo:InvalidOperation:(System.Net.HttpWebRequest:HttpWebRequest)[Invoke-RestMethod],我们
  异常       + FullyQualifiedErrorId:WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

$finalStringToPass  = 
    {"TestCase":[{
    "tc_name":"DebugSheet",
    "tc_module_name":"AdjustmentBilling",
    "tc_status":"PASS",
    "error":"",
    "tc_total_time":"0:25:54",
    "tc_product":"Test Complete",
    "module_version":"SLS 10.2.100",
    "tc_build":"08-08",
    "tc_host":"L505232",
    "tc_log_path":"\\undefined\\index.htm",
    "test_case_owner":"Shreyas",
    "last_maintained_by":"Shreyas",
    "test_case_owner_emails":"shreyas.murali@epicor.com;SkyNetTeam@epicor.com",
    "tc_cell":"SLS",
    "data_type":"testcomplete",
    "test_case_error":"",
    "tc_screenshot_link":"",
    "TestCase Details":"",
    "TestStep Details":"",
    "tc_start":"04/15/2019 11:31:31",
    "tc_end":"04/15/2019 11:31:31",
    "tc_stpes_total":"04/15/2019 11:57:25",
    "custom_params":[{}],
    "tc_steps_total":"0",
    "tc_steps_passed":"0",
    "tc_steps_failed":"0",
    "tc_steps_notexecuted":"0",
    "tc_execdate":"04/15/2019 11:31:31",
    "scenario_data":"Test Scenario Data"
    }],

    "3":[{
    "scn_desc":"Add Accomodation payment history from cash receipts",
    "test_status":"PASS",
    "error_link":"",
    "jira_ref":"",
    "test_case_title":"ClientAccomodationMethod-1",
    "test_file_name":"ClientAccomodationTest(Row#3)"
    }]}

$response1 = Invoke-RestMethod "http://10.63.22.36:81/api/e10/e10PostTCData/" -Method Post -Body =$finalStringToPass -TimeoutSec 600`

    [Route("e10PostTCData/")]
    [HttpPost]
    public HttpResponseMessage PostResults([FromBody]string jsonArray )
    {

    }

0 个答案:

没有答案