How to Mimic Server Down(503) With Windows 8 Phone Emulator, IIS Express, Web Api? - asp.net-web-api

Does anyone know how to get a 503 error to occur when doing a call from code in a windows phone application.
I tried by not running my web api project and just loading up and doing a call to that project but it just comes back 403 and not 503.

You can throw the 503 error with this line of code in your WebAPI controller:
throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.ServiceUnavailable, "Service unavailable");

Related

ASP.NET Core MVC : catch 503 error and redirect to view

In my ASP.NET Core MVC application, I'm trying to catch and isolate 503 error which is coming from the API project, we are intentionally stopping the app pool for the API in order to get the error and instead of this screen:
I want to redirect to a specific view, for example /Home/Error, is there an option to do that in the configuration of the ASP.NET Core MVC project?
Your application running in (or being accessed through) the ASP.NET Core Module is the service that is reported to be unavailable by this error page.
The 503 is returned by IIS, not by your application. The whole reason the 503 is returned, is because your application doesn't respond to IIS, so even if you wanted to, you can't return it from your application.
See Custom Error Page for Http Error 503 to change the IIS 503 error page.

ngrok 404 error with

I'm working on ASP.NET Core application. I had to host online for testing few cases. I tried using ngrok. Everything perfectly done as show on:
C# Corner link
I could see the request being logged in ngrok
But browser stops with 502 bad Gateway.

Ngrok returns 405 error while tunneling my localhost

I have a web app bot that I would like to remote it so a few people can test it. I am using Bot Framework Emulator to test it locally and it works wonders, but I'm thoroughly failing to make ngrok host it.
(I actually managed doing it using the ...azurewebsites.net/api/messages link my app has in Azure with another bot, but I couldn't with this one, so I'm trying with the link ngrok offers me - both bots, the one I managed and this one, are hosted in Azure, but I don't know how to make it available to remote access)
Steps I'm taking:
Deploy the app in Visual Studio so it runs on localhost:3979;
Open port externally in ngrok using ngrok
3979 http -host-header=rewrite localhost:3979;
Get one of the forwarding URLs ngrok provides me, like
https://3d609207.ngrok.io
Insert previous URL in Bot Framework Emulator;
Click Connect.
Both in ngrok and in Bot Framework Emulator returns me 405 Method Not Allowed.
I tried accessing the link I inserted in Bot Framework Emulator and I normally have the page I would see while hosting my bot locally:
Describe your bot here and your terms of use etc.
Visit Bot Framework to register your bot. When you register it,
remember to set your bot's endpoint to
https://your_bots_hostname/api/messages
But I can't send nor receive messages in Bot Framework Emulator.
Additionally, ngrok prints this under the HTTP request headline:
HTTP Requests
-------------
POST / 405 Method Not Allowed
GET /favicon.ico 200 OK
GET / 200 OK
My MSAppID and Password are configured properly in web.config, and compilation results in no error, so I doubt it's something on the code (unless there is some configuration in the code that prevents this bot being accessed remotely for a reason, but I have no idea).
I would very much appreciate any help on this issue. Thanks for your time.
Both in ngrok and in Bot Framework Emulator returns me 405 Method Not Allowed
I can reproduce the issue on my side if I just provide https://xxxxxxxx.ngrok.io as message endpoint.
Please try to specify https://xxxxxxxx.ngrok.io/api/messages as message endpoint, which works for me.

Using GWT getting 405 error message on IIS 7.5

I have inherited a project that is using GWT to post login information via a form. According to Firebug, its coming back with a 405 error.
I have tried the directions on: IIS 7.5, Web Service and HTTP 405 error
That didn't fix the problem. I turned on Failed Request tracking and this is the error that I see:
MODULE_SET_RESPONSE_ERROR_STATUS
Warning
ModuleName="StaticFileModule", Notification="EXECUTE_REQUEST_HANDLER", HttpStatus="405", HttpReason="Method Not Allowed", HttpSubStatus="0", ErrorCode="Incorrect function.
(0x80070001)", ConfigExceptionInfo=""
Thanks!

AJAX enabled WCF service for cascading dropdown method 404 error

I am new to WCF issues and I'm trying to populate an control by using a wcf service . I have used 'Ajax-Enabled WCF' template ( VS 2010) for creating my service. there is no error while on Asp.net development server but when put on IIS [Method 404 Error] appears in dropdown . I tried to access the WCF services directly like (https://sitename/webservice/test.svc) it shows the documentation page.
I have searched for hours to find a solution but no use. I will be thankful if anyone can help me out
Thanks
Can you connect to your IIS hosted service via WcfTestClient (see under Tools)? Also check the endpoint address in App.config on your client...If that does not work, could you post client's App.config and Web.config from Service's IIS?
I had similar issue, where it worked on dev server, but not Integration (got 404, service is not defined error).
The issue was the .svc file type was not mapped in IIS, which fixed the issue.

Resources