I’ve built a .NET Windows Service that keeps monitoring the DB latency from a Web Server. Every time the test runs it sends a Metric to App Insights via the SDK. On my development machine all works fine, but when it’s deployed to the webserver the metrics doesn’t reach the App Insights service because a proxy authentication failure occurs. This is the error that I’ve found by analyzing the network activity:
Proxy Authentication Required. Authentication Failure.Please check your username and password.
How can I set the proxy settings for App Insights for my Windows Service? Is there something similar to the “ApplicationInsights.config” file of web sites?
Many thanks in advance!
Finally I figure it out. What I was missing is setting the proxy on the app.config file adding:
<system.net>
<defaultProxy useDefaultCredentials="true" />
</system.net>
Related
I published a simple .NET 6.0 web app with user authentication on my IIS 10.0 web server hosted on Azure.
The application read and write data from a SQL Server 2017 database hosted on another machine on the same virtual network of the web server.
Everything works fine but after a while, even though nobody is using the app, it stop working and send Http Error 503 Service Unavailable and I have to restart it every time from the application pool.
I enabled tracing on the event log, but I don't receive any message explaining this.
These are the application settings:
IIS application settings
I tried to follow these advices but none of them worked:
IIS HTTP Error 503. The service is unavailable
503 “Service Unavailable” error for all apps after installing .NET Core 2.2 Runtime & Hosting Bundle for Windows
.Net core Service Unavailable after Publish to IIS
On the same web server I have other applications but this problem appears only on this one. None of the other apps is using .NET 6, most use .NET Framework 4.7/4.8 and another couple .NET Core 3.1.
I also tried to publish the application on Azure WebApp service and it has the same problem.
1. If you're deploying on IIS, we can install DebugDiag Tools and then use the DebugDiag collection to crawl the dump logs.
2. If you are using the azure app service, it is recommended to get dump in the azure portal.
My Suggestion
Enable Failed Request Tracing, and find which request will cause the Http 503.
Maybe this 503 is not a problem with the code, and it is possible to find some useful information in the log.
Check the EventViewer, try to find the useful info about the application.
Download the DebugDiag Tools, use debugdiag collection to collect the dump file when the issue occured, and use the debugdiag analysis to analyze the dump file and check the stacktrace.
My suggestion can't tell you the root cause directly, but it will help you to find it. You are also welcome to update the useful stacktrace information in the future, and there will be more people to help you.
I'm currently having the issue but using MySQL on a remote server.
Azure WebApp, Azure VM (IIS 10) and AWS EC2.
Http Error 503 Service Unavailable when the database connection timesout or fails to connect and the AppPool failed to restart.
No crashes when debugging in VS via console app.
I changed the hosting model to out-of-process and this solved the issue.
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" hostingModel="outofprocess">
My problem is the opposite of many problems...
We have a WCF web service which works fine on our 'live' IIS server.
When I run the code in VS (even if running as admin) on the dev machine, I get nothing in the browser, and cannot request ?wsdl which also works on the server.
The web config files on both machines are identical.
What is wrong here, please?
EDIT:
I have added a new WCF project to the solution. That one DOES show the service, present the WSDL and allow browsing of the folder contents.
I copied the web config setting:
<directoryBrowse enabled="true"/>
into my existing web config, but it still won't allow directory browsing.
I'm new to azure mobile services development and any help will be greatly appreciated.
I have created sample mobile service application and could successfully launch and debug it locally. As a next step I've added google authentication. Everything works fine when the service is Published and running in the cloud. But, I could not make the service to run locally so that I can debug the service for cases when the user is authenticated.
So for I have wrestled with IIS Express and made it work with HTTPS on port 44300. But Google authentication services complained because of redirect URLs mismatch, even though I've added https://localhost:44300/signin-google to redirect list.
I feel like I'm not doing something correct here. Something does not make me believe that debugging locally is not possible.
Thanks,
Ruben
Is possible to debug in localhost, but the google/facebook/Microsoft authentication should not be tested, because it is provided out-of-the-box by Azure Mobile Service team.
you should configure it in Azure Portal and then you should implement it in your application like documentation provides.
The following resources has the references to the Authentication articles:
Azure Mobile Services for Client Apps
I'm running Sitecore.NET 7.0 (rev. 140120) with Social Connected 2.0 (for CMS 7.0).
However - unfortunately our corporate environment requires us to connect via a proxy server, so currently my dev environment does not work.
I reflected the code in Sitecore.Social.Facebook.dll and can see the code in Sitecore.Social.Facebook.Connector.Managers.WebRequestManager.GetResponse() that makes the HTTP requests to facebook.com, and which does not appear to reference a proxy.
I have confirmed on another network without proxy requirements that my setup works well.
Is there a way to specify a proxy for such requests? Can I write my own replacement which will allow a proxy to be configured - if so how do I plug this in?
The solution ended up being pretty simple. I added the following into my web.config:
<system.net>
<defaultProxy enabled="true" useDefaultCredentials="true">
</defaultProxy>
</system.net>
You can also specify other proxy configuration using this method which will affect your whole web application.
MSDN Reference
we are doing worklight app on a android and a desktopenvironment(for facebook) that works fine on the liberty profile server (developer worklight environment).
Know we need to post this app on Facebook but to do this we need to use the https protocol on our WAS server, to do this we set the ip, port, protocol: to our external server, and deploy our app with build for remote server, but when the app tried to call an adapter on the server, the Firefox console returns us this:
[09:58:50.675] "response [https://[publicIP]:[port]/WorklightPocProj/apps/services/../../invoke] success: /*-secure-
{"challenges":{"wl_antiXSRFRealm":{"WL-Instance-Id":"ih80d8pjg6la8ubccb7503b936"}}}*/"
and
[09:58:50.675] "defaultOptions:onFailure Procedure invocation error."
The application security on our WAS server is disabled and the ip/port are reachable too.
if i add to the XML adapter on the procedures securityTest="wl_unprotected" the app runs correctly, but i don't to do this workaround
Is there any configuration that we are missing on the app or in our WAS server?
A lot of time since this question but just for trying to help people that hit this question because of the search "defaultOptions:onFailure Procedure invocation error".
Also facing this issue in Worklight 6.1
In my case I faced this issue because I had the following configuration in the adapter .xml:
<procedure name="anyMethod"></procedure>
This works in the development server, but in a stand alone server (at least in WAS) you have to change it for:
<procedure name="submitAuthentication" securityTest="wl_unprotected"></procedure>
In both cases it is unprotected.