私はGET要求を行い、受け取った情報を操作する必要があるいくつかのコードを実行しています。C++デバッグアサーションがHTTPリクエストで失敗しました
:このため、私はこれが私のコード
#include <cpprest/http_client.h>
#include <cpprest/filestream.h>
using namespace utility;
using namespace web;
using namespace web::http;
using namespace web::http::client;
using namespace concurrency::streams;
//This method i saw on the Microsoft documentation
pplx::task<void> HTTPStreamingAsync()
{
http_client client(L"http://localhost:10000/Something"); //The api is running at the moment
// Make the request and asynchronously process the response.
return client.request(methods::GET).then([](http_response response)
{
// Print the status code.
std::wostringstream ss;
ss << L"Server returned returned status code " << response.status_code() << L'.' << std::endl;
std::wcout << ss.str();
// TODO: Perform actions here reading from the response stream.
auto bodyStream = response.body();
// In this example, we print the length of the response to the console.
ss.str(std::wstring());
ss << L"Content length is " << response.headers().content_length() << L" bytes." << std::endl;
std::wcout << ss.str();
});
}
void main(int argc, char **argv)
{
HTTPStreamingAsync().wait();
//...
}
であると私はデバッグを使用するときに、私は次の行でエラーが出る要求
のためにC++ REST SDK(コードネーム「カサブランカ」)を使用していますデバッグでclient.request(メソッド:: GET).then([](HTTP_RESPONSE応答)
を返す私は、変数 "クライアント" は、コンテンツを持っていることがわかり、私はまだ、このエラーが表示されます。
私はそれを人々のほとんどは、それがコードに誤りであると言うエラー、およびグーグル(メモリの一部にアクセスしようとしている)...
任意のアイデアは?
他の場所では、 '__acrt_first_block == header'があるかもしれませんが、これはアサーションとして使用されており、失敗します(' false')。あなたの質問に貼り付けたMicrosoftコードは、そのアサーションを実行していることを示しています。だから、人々があなたを助けるために詳細を追加する必要があるかもしれません。 – CPHPython
プロジェクトからすべてのファイルを検索しましたが、 "__acrt_first_block == header"が見つかりませんでした。このプロジェクトのすべてのコードの上のコード – Tazz
問題を修正しました。今私は常に1を返す応答本文に他の問題がありますが、私はそれを修正します!すべての助けをありがとう! :) – Tazz