github Repository: < /p>
Код: Выделить всё
git clone https://github.com/samxxxxx/voloabpwinformwrap.git
В модуле wry_test.web project's wry_testwebmodule , регистрируя пользовательскую службу обертывания результатов с помощью контекста. Services.registerWraPresult (true); вызывает следующее исключение при вызове интерфейса ibookappservice
с: < /p>
context.Services.AddHttpClientProxies(
typeof(wrap_testApplicationContractsModule).Assembly,
RemoteServiceName
);
< /code>
- Исключить переопределение wry_test.dynamicproxing.wrapidescriptionfinder < /code> файл. < /p>
< /li>
call1, call2 или call3 в форме1. Object. ”[/code] Exception.
Структура ответа на заказ:
Код: Выделить всё
{
"data": T,
"success": true
}
Код: Выделить всё
protected virtual async Task GetApiDescriptionFromServerAsync(
HttpClient client,
string baseUrl)
{
var requestMessage = new HttpRequestMessage(
HttpMethod.Get,
baseUrl.EnsureEndsWith('/') + "api/abp/api-definition"
);
AddHeaders(requestMessage);
var response = await client.SendAsync(
requestMessage,
CancellationTokenProvider.Token
);
if (!response.IsSuccessStatusCode)
{
throw new AbpException("Remote service returns error! StatusCode = " + response.StatusCode);
}
var content = await response.Content.ReadAsStringAsync();
var result = JsonSerializer.Deserialize(content, DeserializeOptions)!;
return result;
}
< /code>
Аналогично, десериализация в Dynamichttpproxyinterceptorclientproxy.requestasync (clientproxyrequestcontext requestContext) < /code> также будет столкнуться с проблемами. class = "lang-cs prettyprint-override">protected virtual async Task RequestAsync(ClientProxyRequestContext requestContext)
{
var responseContent = await RequestAsync(requestContext);
if (typeof(T) == typeof(IRemoteStreamContent) ||
typeof(T) == typeof(RemoteStreamContent))
{
/* returning a class that holds a reference to response
* content just to be sure that GC does not dispose of
* it before we finish doing our work with the stream */
return (T)(object)new RemoteStreamContent(
await responseContent.ReadAsStreamAsync(),
responseContent.Headers?.ContentDisposition?.FileNameStar ??
RemoveQuotes(responseContent.Headers?.ContentDisposition?.FileName).ToString(),
responseContent.Headers?.ContentType?.ToString(),
responseContent.Headers?.ContentLength);
}
var stringContent = await responseContent.ReadAsStringAsync();
if (typeof(T) == typeof(string))
{
return (T)(object)stringContent;
}
if (stringContent.IsNullOrWhiteSpace())
{
return default!;
}
return JsonSerializer.Deserialize(stringContent);
}
Подробнее здесь: https://stackoverflow.com/questions/797 ... eturn-null
Мобильная версия