I have this exception:
[Microsoft.WindowsAzure.Messaging.RegistrationAuthorizationException] = {Microsoft.WindowsAzure.Messaging.RegistrationAuthorizationException: HTTP request failed.
HTTP Details:
Status: 401
Reason: Unauthorized
Full content: 401ExpiredToken: . TrackingId:8a536a39-5852-4b36-8eae-b7e46ccdfe78_G0,T...
I have a Windows Phone 8.1 silverlight application. The application registers itself for toast notifications. All was working fine until I got the request to allow the customer (limited audience) to update the text displayed on the screen. So I provided them with a web form that they can update the content and the phone app reads the content from the web and displays it.
However after adding this code that uses async/await keywords I now get this new exception when I try to register the notification.
The line that throws is:
await hub.RegisterNativeAsync(args.ChannelUri.ToString());
I can't see how adding code to main.xaml.cs could impact code in the app.xaml.cs, but it has. My thinking is the await/async keywords are getting confused. Anyone have any idea what might be happening here? BTW:I updated the time in the emulator as that seemed to be the only other time people got this error.
Related
Our asp.net web app is returning Error 520 on a page in production though no error in development.
This particular error skips our custom error page and present a different error page with Cloudflare.
As in this image
When you inspect the page, you see
"Error: Promised response from onMessage listener went out of scope"
in console
No error is logged by our logging tools, and we cannot tell why it's skipping our custom error page.
Any direction as to how to solve this?
I have a Blazor app that will be opened via a parent site into a child window. I then want the Blazor app to Post information back to the parent site using this function:
function OpenDocument(URL) {
window.opener.postMessage(URL, "*");
return false
}
This function is triggered by a switch case depending on what file the user clicks on. This is the switch statement code.
string res = "url string" ;
await JSRuntime.InvokeAsync<string>("OpenDocument", Res);
This is the error message that I am getting in Chrome when the javascript function is triggered.
blazor.server.js:formatted:2869 Uncaught (in promise) Error: Cannot send data if the connection is not in the 'Connected' State.
I have looked around for information on this problem and can't seem to find much on it. Any help would be appriciated.
Discovered a work around for anyone that might encounter this problem. Open a blank webpage with a url paramater as the message you want to post and have the blank web page post the message for you. If anyone has any better solutions please post them anyway.
I have two ASP.NET MVC web apps running on the same server. One of them is a web service that returns an error message in plain text if an exception occurs. However, right now, some clients that call the web service don't receive the error message; instead, they simply receive "Bad Request" in HTML.
The second web app (on the same server as the first) can call a URL handled by the first one and, right now, correctly receives the error message in plain text. However, I have tried calling that URL other ways, and all of them have resulted in receiving "Bad Request":
Pasting the URL into Chrome on my computer
Pasting the URL into IE on the server
Calling the URL from a web app on a different computer from the server
This error does not occur locally. When I run the 2 web apps on my computer, I receive the error message in plain text from both the second web app and from calling the local URL from Chrome.
I have narrowed down the offending line of code to the first line of the following ActionResult snippet:
Response.StatusCode = (int)HttpStatusCode.BadRequest;
return Content(errorMessage, ContentTypes.PlainText);
Removing the first line appears to fix the problem; however, that also eliminates the ability for me to use a descriptive status code. It appears to me that after the ActionResult is returned the response is being intercepted if either (a) the client is on a different computer or (b) the client is a web browser. So I guess I have a 2-part question:
Is there a reason why .NET or IIS would intercept and change a response depending on the client type or location?
Is there an easy way to view the response at any point between this code and when it's dispatched to the client?
Thanks!
Update: I changed the web app to use HttpResponseException. Now I am getting the following YSOD exception:
Processing of the HTTP request resulted in an exception. Please see
the HTTP response returned by the 'Response' property of this
exception for details.
Using MVC version 5, Visual Studio 2013. The code for the ActionResult looks like this:
MyImage image = new MyImage(parameters);
if (image.Errors.Any())
{
throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.BadRequest) { Content = new StringContent(image.Error) });
}
return File(image.AsJpeg(), ContentTypes.Jpeg);
Anyone have an idea how to bypass this unhelpful response?
Update 2: The issue turned out to be that the error message was being suppressed because of the Web.config setting system.webServer > httpErrors > errorMode which has a default value of "DetailedLocalOnly" and seems to be invoked in some cases for a reason I don't know (although this question may start to shed some light). Once I changed it to this, it worked as I expected:
<httpErrors errorMode="Detailed" />
I understand why they suppress error messages by default on remote machines, but this was a lot harder to track down than I would have thought. Anyway, I hope this is helpful to someone in the future.
I can't think of any reason why IIS would care what client was calling a service. My guess is that the client is sending a different request to the server than what you think it is sending. You can verify this by using a program called "Fiddler".
Also, I'd recommend following a pattern that returns a HttpResponseMessage like this when sending back information from a Web API call:
return new HttpResponseMessage(HttpStatusCode.BadRequest)
{
ReasonPhrase = message,
Content = new StringContent(string.Format("{0}", exception))
};
I've attempted to follow tutorials for both Xamarin (http://docs.xamarin.com/guides/android/platform_features/maps_and_location/maps/part_2_-_maps_api/), and Google Play (it is in the Google Play Services getting started page on Xamarin Studio) to get a working maps example.
Back in December, a friend of mine used my phone to develop a map app using his own laptop. However when I tried compiling his code on my computer, I was getting the same error below. I don't have another android phone to test with, but I can't figure out why it isn't working. I imagine the error lies within my target sdk, which is 19. The API key I'm using is provided from Google and pasted it in like the tutorials say, so I don't think that's the issue. So the issue must lay within the SDK I have, or my computer. I'm just not sure how to test it or further debug it.
The error being spit out over and over again until I leave the page is this:
[AndroidHttpClient$2] executeRequestSending() director.getClass()=class org.apache.http.impl.client.DefaultRequestDirector [AndroidHttpClient$2] executeRequestSending()#finished <<<<< nafResponseWrapper=NafResponseWrapper [httpResponse=HTTP/1.1 400 Bad Request, usedCipherSuiteAndroidName=TLS_ECDHE_RSA_WITH_RC4_128_SHA] [AndroidHttpClient$2] execute() finalHttpResponse.getStatusLine()=HTTP/1.1 400 Bad Request [AndroidHttpClient$2] execute()#finished
Turns out the package name was wrong when signing up for the API key. The hidden in the flood of messages about the 400 bad request.
Silly mistakes and such. I feel silly for making this post honestly.
Where would I need to hook in (at what event) to be able send myself every 500 error that happens on my current ASP.NET project. Something inside the global.asax? And I'd like to send myself the output that the user would see. The white/yellow/black 500 standard ASP.NET error HTML.
My users only see the errors about 10% of the time. The other 90% these are Ajax responses.
You can do this in global.asax.cs using Global Error Handling in ASP.Net using the Application_Error(...) method
If you're more interested in the end result than in the process of making it work yourself, you might like to take a look at the Elmah ("Error Logging Modules and Handlers") project - http://code.google.com/p/elmah/
It's allows you to do many things with errors - send email notifications, log them to a database, browse the error log via a web interface, and even crazy things like an RSS feed of errors or using Twitter to tweet errors.
It's quite easy to install and configure.