Calling webservices from Silverlight 3 when running out-of-browser - asp.net

We have this nice Silverlight 3 application that communicates with a web server running some WCF web services. It works well when it is running in the browser, but at soon we try to run it outside the browser it doesn't call our webservices.
I have tried to find out why this is happening, but I can't find any explanation.
When attaching the debugger to the sllauncher.exe process I am able to step through the code and I can see that the (Begin)Async method is called. But using Fiddler I can see that there is no traffic to the server at all!
I have also verified that the endpoint address is correct and that the endpoint is properly configured (it works when running in the browser after all).
So I am wondering what can be the cause of the problem and how to debug it. Any ideas?
EDIT:
I noticed that our application doesn't run in Internet Explorer either. But it runs fine in Firefox! This isn't much of a surprise since the out of browser application embeds internet explorer, but it may be a clue to our problem.
So, do you know of any differences between hosting silverlight in Firefox versus Internet Explorer?

Maybe worth putting a try catch around your web service call and see what exception is thrown to help further debug this issue as webservices that work ok in browser should work OOB as far as I'm aware.

The issues we have experiences with OOB have all had to do with local machine setup. If you are behind a proxy, turn it of temporarily. Also check your firewall to ensure it will let the web service traffic through.
For easier debugging, if you have not already done so, wrap your service calls like this:
using System.Net;
if (NetworkInterface.GetIsNetworkAvailable()) { doSomethingAsync(); }
else { //Report the error or show status in UI }

It works in Firefox and not IE, because firefox is alot more willing to accept temporary certificates. Are you running a certification server?
The reason no traffic hits fiddler is because either
You have no clientaccesspolicy.xml on the HTTPS address you are accessing.
you are running the Silverlight app from within visual studio, hence running the website that hosts the SL clientbin from within visual studio, the ASP development server prevents certain calls from being made, esp if your webservice address is different from the address that the website is hosted on and certain ports dont respond resulting in the most odd behavior of fiddler doing absolutely nothing.
Either way the behavior of the SL app not contacting the web server when using HTTPS, is due to the hosting environment restrictions (try deploying in IIS) or the willingness of the client to accept the certification encryption strategy.

Related

Client app able to call API Locally but unable to do it in IIS

I have an application that his a .Net Core API.
Everything works locally, and by that means,
Client App --> hits an .Net Core API successfully.
Howevever we have pushed the app to IIS Server, and we are not able to successfuly hit the API.
I know this is extremely vague, but what is something that I should be looking at to diagnose address this. I pulled the code from the published branch, and it works like a charm on local, but does not work on Server.
I do not get any Server Side exceptions.
Is there network connectivity? Log into the server and open a browser and put in the URL to the API. Any HTTP error is good. It means you can reach the API. If it times out, that's bad and that's your problem.
How do you know there are no exceptions? Are you logging all exceptions? Are you sure no exceptions are hidden in try blocks that end up ignoring the exception?
Assuming it's a Windows server, check the Event Viewer for warnings or errors.

Web application doesn't work with server name and windows authentication but does with IP Address

I have an application that was working on a II 6 development server that uses Windows Authentication. It is a Iron Speed application and I updated a few items and deployed it to the test server where it was previously tested. After deployment, the application doesn't work with Windows Authentication, doesn't even get the credentials login, when I used the full name devweb.etc. It displays a 403 error. However, if I use the IPaddress for it, everything works fine. If take away the windows authentication, the app shows up but of course doesn't work saying it needs a login but it does resolve the web address correctly. I have other applications on the devweb server without window authentication that work without a problem.
Does anyone have any idea of what could cause an application to act in this way?
This ended up being a firewall related issue. More specifically, the firewall switched various websites with the server name devweb to another server which worked fine. Thus, when it appeared like the server was working because devweb sites were working but my particular site on devweb wasn't working except when using the ipaddress. In fact the server was not working correctly and their was a DNS entry problem. Overall, a very frustrating comedy of errors that took too many hours of my life.

call asp.net webservice on localhost

I have been given a task where I have to write some code for an ASP.NET website that also uses a webservice.
The webservice works fine on the webserver, but when i run in debug mode in Visual Studio, I get an access not allowed when calling one of the methods (ip 127.0.0.1).
I need to run in debug mode to look at what the code does...
What to do from here ?
Do I need to do some changes in the host file.
Do I need to install IIS on my PC instead of using the VS local webserver (cassini)
Cassini web server does not allow remote connections. You could use Fiddler to forward traffic on localhost to another port on the same machine for some given requests.
By far the easiest solution is to install IIS on your local machine and run it from there.
Cassini is fine for development and getting something running up very quickl.
But never us it to test things that will go into production on a "real" IIS.
Yes, Microsoft says its completely the same, but running on your localmachine also IIS gives you exactly the same environment as you will have on any live hosting environment.
Sure, its a little bit more work, but developing this way reduces errors and artefacts which may steal you some time.

How can I test pages with web services when only Cassini is available (no IIS allowed)?

I'm developing a web site in a high-security environment. For example, we use CAC cards to authenticate users over SSL.
The site is a mix of VB.NET and C# on .NET 3.5 with some AJAX. The AJAX parts are now calling web services for things like Cascading Drop Down Lists.
We've been running VS2008 configured on our local PCs to use IIS instead of the default server (Cassini). However, some security policies were rolled out to the desktops over the weekend and, suddenly, we're not allowed to run IIS on our PCs anymore.
I already have some of our IT people trying to appeal for waivers for developers. In the meantime, I need to find a way to keep developing.
If I turn off the SSL requirement to the 'secure' part of the application (locally, my PC only) I can serve up some of the pages (using Cassini) when I hit "F5", but pages with web services just bring up "server application unavailable".
I need to be able to add some more functions into the existing web services, among other things, so the ability to single-step through the code is still a necessity.
I'm sure someone who is limited to using Cassini has found a way to Build/Debug pages in VS2008 when webservices are involved.
Thanks in advance.
EDIT: As it turns out, some links had "HTTPS://" hard-coded in them (I inherited these). Changing the link to "~\folder\page.aspx" allowed Cassini to properly serve things up.
Note that using Cassini is the default for VS2k8, even for Web Services. Try starting a new HelloWorld web service project and confirm if you can debug it.
OK So that worked. Then change the debugging options of your real project back to using Cassini rather than IIS. I wouldn't move the project (although backing it up might not be a bad idea) as you might be able to get IIS working again.
EDIT: So your actual problem wasn't to do with web services, just hard-coded URLs. (We have similar problem where much of the site works where ever the root of the website is, but some places, such as "main menu" links, expect the root to be the root of the webserver.)
You proabbly need to contact your IT department and have them open up something on the network so you can call the services - a port on a firewall, for instance.

Very weird IIS6 asp.net website behaviour

I have a weird issue with my website. This is asp.net(.net 3.5) website hosted on a dedicated server IIS6.
Recently I got a strange behavior, the website hangs and just doesn’t reply unless I go to iis and restart either app pool or whole IIS - BUT what is the most strange thing is that in case I go to remote desktop of the server and try to access it locally it DOES work just fine.
I read couple threads about deadlocking and hanging because of memory leaks and non closed sql connections BUT why it still does work from the local?
In case there is something wrong with the code – why does it still work from locally?
In case there is some issues on the hosting side (like firewall issues) then why does iisreset help?
Any thoughts would be appreciated. Thank you!
We've just run into this problem, and we have a solution. IIS has two thread pools to handle requests. One thread pool is used for external requests. Another pool is used for local requests. Our problem was caused by a deadlock in backend code. Once the deadlock occurred, all external requests were queued but not serviced because all of the servicing threads were in use. Opening the website from the web server uses the other thread pool, so the requests are serviced. We were absolutley positive it was a network issue, but WinDbg proved otherwise.
See here for more information:
MSDN blog entry about IIS and threads
minLocalRequestFreeThreads
(Also, search for minFreeThreads to see the non-local request thread pools.)
Good luck!
Are you sure that the website hangs for all external users, so that it's not just one single user?
The IIS only runs one page at a time for each user, so if one request is caught in an eternal loop, that single user will experience that the server has stopped completely as no pages at all work until that page times out. The server will still work as usual for other users.
You can test this by using a different browser, or starting a new instance of the same browser (possible with IE, not with Firefox).
Hmm not enough info to really give you an answer, but I would look at your firewall first if it responds locally from the server. Do you have another server behind the FW like a SQL server? Try browsing from that as it will show you where the problem is.
My though would be a badly configured load balancer.

Resources