I am trying to get all tabs added for a channel
But I am seeing Error.
var tabs = await graphServiceClient.Teams[team.Id].Channels[chanel.Id].Tabs.Request().GetAsync();
Error
{Status Code: InternalServerError
Microsoft.Graph.ServiceException: Code: InternalServerError
Message: Failed to execute request.
Inner error:
AdditionalData:
request-id: 005d47b1-e52e-4ea6-96d4-d0dfb6cfafa7
date: 2020-02-03T08:14:32
ClientRequestId: 005d47b1-e52e-4ea6-96d4-d0dfb6cfafa7
at Microsoft.Graph.HttpProvider.SendAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken)
at Microsoft.Graph.BaseRequest.SendRequestAsync(Object serializableObject, CancellationToken cancellationToken, HttpCompletionOption completionOption)
at Microsoft.Graph.BaseRequest.SendAsync[T](Object serializableObject, CancellationToken cancellationToken, HttpCompletionOption completionOption)
at Microsoft.Graph.ChannelTabsCollectionRequest.GetAsync(CancellationToken cancellationToken)
at S27.Application.Services.MSGraphAPIService.GetTabs(TeamSettingModel team, TeamsChannelModel chanel, GraphServiceClient graphServiceClient)
And help?
Try removing one by one each tab in your channel and try to execute your code again.
In my case there was a Website Tab with some issue. That tab was added via API and the server returned an error despite the tab was added.
Not a good error message and a very bad API behaviour anyway..
Related
I have built an iOS app using Xamarin Forms. it is integrated into firebase crashlatics. so i am getting a error from couple of ios users.
Non-fatal Exception: Unable to read data from the transport connection: The socket is not connected.
at System.Net.Sockets.Socket+AwaitableSocketAsyncEventArgs.ThrowException (System.Net.Sockets.SocketError error) <0x105528640 + 0x0001c> in <11ade8ccf21d4e088feeebdfa82d9e3b#d1ce4374a462223982a60b97d03a2ef1>:0
at System.Net.Sockets.Socket+AwaitableSocketAsyncEventArgs.GetResult (System.Int16 token) <0x1055284b0 + 0x00073> in <11ade8ccf21d4e088feeebdfa82d9e3b#d1ce4374a462223982a60b97d03a2ef1>:0
at System.Threading.Tasks.ValueTask`1+ValueTaskSourceAsTask+<>c[TResult].<.cctor>b__4_0 (System.Object state) <0x104d714f0 + 0x00173> in <d7378003255d47168c07c9b138461e80#d1ce4374a462223982a60b97d03a2ef1>:0 --- End of stack trace from previous location where exception was thrown ---
at Mono.Net.Security.MobileAuthenticatedStream.InnerRead (System.Boolean sync, System.Int32 requestedSize, System.Threading.CancellationToken cancellationToken) <0x10544c170 + 0x0039b> in <11ade8ccf21d4e088feeebdfa82d9e3b#d1ce4374a462223982a60b97d03a2ef1>:0
at Mono.Net.Security.AsyncProtocolRequest.InnerRead (System.Threading.CancellationToken cancellationToken) <0x1054467a0 + 0x0024b> in <11ade8ccf21d4e088feeebdfa82d9e3b#d1ce4374a462223982a60b97d03a2ef1>:0
at Mono.Net.Security.AsyncProtocolRequest.ProcessOperation (System.Threading.CancellationToken cancellationToken) <0x105446120 + 0x00227> in <11ade8ccf21d4e088feeebdfa82d9e3b#d1ce4374a462223982a60b97d03a2ef1>:0
at Mono.Net.Security.AsyncProtocolRequest.StartOperation (System.Threading.CancellationToken cancellationToken) <0x105445cd0 + 0x00273> in <11ade8ccf21d4e088feeebdfa82d9e3b#d1ce4374a462223982a60b97d03a2ef1>:0
at Mono.Net.Security.MobileAuthenticatedStream.CheckThrow (System.Boolean authSuccessCheck, System.Boolean shutdownCheck) <0x1054484a0 + 0x0002f> in <11ade8ccf21d4e088feeebdfa82d9e3b#d1ce4374a462223982a60b97d03a2ef1>:0
at Mono.Net.Security.MobileAuthenticatedStream.StartOperation (Mono.Net.Security.MobileAuthenticatedStream+OperationType type, Mono.Net.Security.AsyncProtocolRequest asyncRequest, System.Threading.CancellationToken cancellationToken) <0x1
But still, I have no idea from where and why the problem is happening. anyone having idea
This error usually means that the target machine is running, but the service that you're trying to connect to is not available. (Either it stopped, crashed, or is busy with another request.)
So, you may want to check your network or do something like that, you can check this question, it explained the problem well Unable to read data from the transport connection : An existing connection was forcibly closed by the remote host
Description:
A .Net Core 3.1 Web API project contains an IHostedService-implementing service which reads cache data from PostgresDB in StartAsync method. This cache-retrieving service has been registered in Startup's ConfigureServices method
Problem:
While running integration tests in Jenkins I've found that exception is being thrown while trying to connect to the Db:
[19:49:34 ERR] An error occurred using the connection to database 'FooDb' on server 'tcp://localhost:5432'.
[19:49:34 INF] A transient exception has been encountered during execution and the operation will be retried after 0ms.
Npgsql.NpgsqlException (0x80004005): Exception while connecting
---> System.Net.Sockets.SocketException (99): Cannot assign requested address
at System.Net.Sockets.Socket.BeginConnectEx(EndPoint remoteEP, Boolean flowContext, AsyncCallback callback, Object state)
at System.Net.Sockets.Socket.UnsafeBeginConnect(EndPoint remoteEP, AsyncCallback callback, Object state, Boolean flowContext)
at System.Net.Sockets.Socket.BeginConnect(EndPoint remoteEP, AsyncCallback callback, Object state)
at System.Net.Sockets.Socket.ConnectAsync(EndPoint remoteEP)
at Npgsql.NpgsqlConnector.ConnectAsync(NpgsqlTimeout timeout, CancellationToken cancellationToken)
at Npgsql.NpgsqlConnector.ConnectAsync(NpgsqlTimeout timeout, CancellationToken cancellationToken)
at Npgsql.NpgsqlConnector.RawOpen(NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken)
at Npgsql.NpgsqlConnector.Open(NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken)
at Npgsql.ConnectorPool.AllocateLong(NpgsqlConnection conn, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken)
at Npgsql.NpgsqlConnection.<>c__DisplayClass32_0.<<Open>g__OpenLong|0>d.MoveNext()
This issue is limited to integration tests run, e.g. the service works fine in other scenarios.
What have I tried so far?
As per MSDN suggestion I've moved the registration of my cache reading service to Program.cs CreateHostBuilder method;
Refactored cache retrieval to IStartupFilter implementation
none of these steps helped.
Also, I've removed the cache reading service's registration to confirm that its invocation is causing the issue. Indeed, everything works fine if I don't add the cache reading service.
I am getting below errors while executing my integration test for one of method to post the data in the dynamics crm. This is the first time i am writing integration test where my project is web api using to swagger and some of the azure resources like key vault, active directory.
While executing the Get call it seems to run fine all the steps are performed and getting results as well. But for Post call i can see the call is successful and database is inserted record for the latest call but while returning execustion point back to my integration test from my PostAsync method it fails in between.
Below is the error:
Message:
System.IO.IOException : The request was aborted or the pipeline has finished
Stack Trace:
ResponseStream.CheckNotComplete()
ResponseStream.WriteAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken)
ErrorHandller.InvokeAsync(HttpContext context)
AuthenticationMiddleware.Invoke(HttpContext context)
StaticFileMiddleware.Invoke(HttpContext context)
SwaggerUIMiddleware.Invoke(HttpContext httpContext)
SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
CorrelationIdMiddleware.Invoke(HttpContext context, ICorrelationContextFactory correlationContextFactory)
<<SendAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
ClientHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
GeoIntegrationTest.Test_AddState() line 72
--- End of stack trace from previous location where exception was thrown ---
and the code is as below
public async Task Test_AddState()
{
try
{
var data = new StateRequestModel
{
StateCode = "AL",
Name ="Alabama",
}
};
ByteArrayContent byteContent = BuildRequestObject(data);
var response = await httpClient.PostAsync("api/Geo/AddState", byteContent);
var result = response?.Content.ReadAsStringAsync().Result;
var addStateReposne = (ResponseModel<List<string>>) JsonConvert.DeserializeObject(result);
Assert.NotNull(result);
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
}
catch (Exception ex)
{
throw;
}
}
Please help me to fix this issue and advice me if i can improve the code quality.
So, I got it resolved myself only. The problem was with the Timeout due to some long running process which was running more than default timeout of the HttpClient object.
client.Timeout = System.TimeSpan.FromMinutes(5);
Thanks everyone!!!
In our application, we are using docker container to run the web services.
When I am trying to connect to web services, sometimes I am getting the following error.
An error occurred while sending the request. Unable to read data from the transport connection: Connection reset by peer.
Stack Trace
Exception: at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.SendWithNtConnectionAuthAsync(HttpConnection connection, HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at Microsoft.Extensions.Http.Logging.LoggingHttpMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at Microsoft.Extensions.Http.Logging.LoggingScopeHttpMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
at MyLib.HttpHelper.HttpClientHelper.InternalRequestAsync(RequestContext requestContext)
at MyLib.HttpHelper.HttpClientHelper.RequestAsync[T](RequestContext requestContext) Inner Exception:
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error)
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.GetResult(Int16 token) at System.Net.Http.HttpConnection.FillAsync()
at System.Net.Http.HttpConnection.ReadNextResponseHeaderLineAsync(Boolean foldedHeadersAllowed)
at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, CancellationToken cancellationToken)
I went through many threads but that doesn't help.
Could you please suggest how to look further into that?
Thanks!
In my application, I am using a code piece to send a content to a web proxy with a URL with an interval of 2 seconds between each post. The message to post in the below code is given as static string, but will be dynamic in the original application code.
for (ic = 0; ic < 30; ic++)
{
using(HttpClient httpClient = new HttpClient())
{
Encoder encoder = new Encoder(); //This is a class which we created
AuthorizationHeaders authorizationHeaders = encoder.getAuthorization(PARTNER_ID, PARTNER_KEY, URL, "POST", "application/xml");
httpClient.DefaultHeaders.Add("Accept", "*/*");
httpClient.DefaultHeaders.Add("Authorization", authorizationHeaders.getAuthorizationHeader());
httpClient.DefaultHeaders.Add("Expires", authorizationHeaders.getExpiresHeader());
httpClient.DefaultHeaders.Add("origPartnerId", "MyWebSite");
httpClient.DefaultHeaders.Add("appId", "440");
httpClient.DefaultHeaders.Add("Content-Type", "application/xml");
string inputUrl = ConfigurationManager.AppSettings["url"];
String detailRequest = "<?xml version=\"1.0\" encoding=\"utf-8\"?><Message><Details><Name>Bob</Name><Age>45</Age></Details></Message>";
var content = HttpContent.Create(detailRequest, Encoding.UTF8, "application/xml");
response = httpClient.Post(inputUrl, content).EnsureStatusIsSuccessful();
Thread.Sleep(2000);
}
}
But I am getting the below exception when contacting the proxy. I am not getting it all the time, the message does go through some time, but eventually, this exception comes.
GetResponse timed out ---> System.TimeoutException: GetResponse timed out ---> System.Net.WebException ---> System.Net.WebException: The operation has timed out
at System.Net.HttpWebRequest.GetResponse()
at Microsoft.Http.HttpWebRequestTransportStage.HttpTransportAsyncResult.PopulateWebResponseSync(WebRequest request, IAsyncResult result)
at Microsoft.Http.HttpWebRequestTransportStage.HttpTransportAsyncResult.PopulateWebResponse(HttpTransportAsyncResult self, IAsyncResult result, Func`3 getResponse)
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
at Microsoft.Http.AsyncResult.End[TAsyncResult](IAsyncResult result, Boolean throwException)
at Microsoft.Http.HttpWebRequestTransportStage.EndProcessRequestAndTryGetResponse(IAsyncResult result, HttpResponseMessage& response, Object& state)
at Microsoft.Http.HttpWebRequestTransportStage.ProcessRequestAndTryGetResponse(HttpRequestMessage request, HttpResponseMessage& response, Object& state)
at Microsoft.Http.HttpStageProcessingAsyncResult.NextRequest(HttpStageProcessingAsyncResult self)
--- End of inner exception stack trace ---
at Microsoft.Http.HttpStageProcessingAsyncResult.Complete(HttpStage stage, Exception e)
at Microsoft.Http.HttpStageProcessingAsyncResult.NextRequest(HttpStageProcessingAsyncResult self)
at Microsoft.Http.HttpClient.Send(HttpRequestMessage request)
at Microsoft.Http.HttpClient.Send(HttpMethod method, Uri uri, RequestHeaders headers, HttpContent content)
at Microsoft.Http.HttpMethodExtensions.Method(HttpClient client, HttpMethod method, Uri uri, HttpContent body)
at Microsoft.Http.HttpMethodExtensions.Method(HttpClient client, HttpMethod method, String uri, HttpContent body)
But this proxy is just a redirection to another one. So I tried directly to that one also. There, I was able to do this 2 or 3 times successfully but it generated another exception after that. I tried again, but this time, the exception came for the first try itself. I waited for some time and then tried again, and surprisingly, it did go through 2 or 3 times and then again the exception came. The exception that I am getting this time is different and it is this...
Microsoft.Http.HttpStageProcessingException ---> System.Net.WebException ---> System.Net.WebException: The underlying connection was closed: The connection was closed unexpectedly. at System.Net.HttpWebRequest.GetResponse() at Microsoft.Http.HttpWebRequestTransportStage.HttpTransportAsyncResult.PopulateWebResponseSync(WebRequest request, IAsyncResult result) at Microsoft.Http.HttpWebRequestTransportStage.HttpTransportAsyncResult.PopulateWebResponse(HttpTransportAsyncResult self, IAsyncResult result, Func3 getResponse) --- End of inner exception stack trace --- at Microsoft.Http.AsyncResult.End[TAsyncResult](IAsyncResult result, Boolean throwException) at Microsoft.Http.AsyncResult.End[TAsyncResult](IAsyncResult result) at Microsoft.Http.AsyncResult1.End(IAsyncResult result) at Microsoft.Http.HttpWebRequestTransportStage.EndProcessRequestAndTryGetResponse(IAsyncResult result, HttpResponseMessage& response, Object& state) at Microsoft.Http.HttpWebRequestTransportStage.ProcessRequestAndTryGetResponse(HttpRequestMessage request, HttpResponseMessage& response, Object& state) at Microsoft.Http.HttpStageProcessingAsyncResult.NextRequest(HttpStageProcessingAsyncResult self) --- End of inner exception stack trace --- at Microsoft.Http.HttpStageProcessingAsyncResult.Complete(HttpStage stage, Exception e) at Microsoft.Http.HttpStageProcessingAsyncResult.NextRequest(HttpStageProcessingAsyncResult self) at Microsoft.Http.HttpStageProcessingAsyncResult..ctor(HttpStageProcessingAsyncState state, AsyncCallback callback, Object user) at Microsoft.Http.HttpClient.Send(HttpRequestMessage request) at Microsoft.Http.HttpClient.Send(HttpMethod method, Uri uri, RequestHeaders headers, HttpContent content) at Microsoft.Http.HttpClient.Send(HttpMethod method, Uri uri, HttpContent content) at Microsoft.Http.HttpMethodExtensions.Method(HttpClient client, HttpMethod method, Uri uri, HttpContent body) at Microsoft.Http.HttpMethodExtensions.Method(HttpClient client, HttpMethod method, String uri, HttpContent body) at Microsoft.Http.HttpMethodExtensions.Post(HttpClient client, String uri, HttpContent body)
Any help in this regard would be greatly appreciated because I am after this for the past few days and I have read some articles and even questions in stackoverflow also, but nothing helped me. Thanks in advance...
The proxy rules of some companies will cause problems with POST requests.
GET requests work fine. Check that your OS proxy setting is disabled.
Windows 7: Control Panel > Internet Options > Connections (Tab).
Then click on the "LAN settings" button and then uncheck "Use a proxy server for your LAN".
Alternatively, try and get your Network Admins to add the connection that you are using to the exclusion list.