WCF-RIA Services Client OutputCache - not working in IE with localhost - silverlight

We are using the WCF-RIA Services in our project.
On part is a search which will trigger a RIA request on the server.
For this request we have enabled the Client output cache using this attribute:
[OutputCache(OutputCacheLocation.Client, duration: 2 * 60)]
We want to use the client cache, because the information to be cached are user specific. The problem ist, that the cache works fine in Firefox and IE after the application is installed in an IIS, but while debugging IE seems to ignore the caching.
Maybe this is not really a RIA Service specific problem but more of an IE problem. It looks as IE sees "Hey, this is a request to localhost, I don't want to cache that" (some kind of feature).
This is a bit unhelpful, because the debugging situation is not the same as the "live" situation.
Is there a way to use the WCF-RIA Services client cache in IE while debugging?

You should be able to test this using either your machine name in the URL or using localhost. (note the dot at the end) instead of localhost. See here for more info.
Once you have it working with Fiddler you should be able to see if your caching is on or off and debug it.

Related

HTML files not cached when requested on localhost

recently we made changes to one of our applications and we noticed that our customers are not getting the new views. So we decided to version the files so we can force the client's browsers to fetch the new views every time we have a new version.
So far so good, but we needed to test this in a local environment before deploying this change (the versioning). Unfortunately, on localhost the views are never cached. I noticed that the requests for the views are sent with Cache-Control:max-age=0. If I am not mistaking this causes the resource to not be cached.
I read also that this could be caused by the ETag header, so I removed it but the views are still not cached. Also, I set the Cache-Control:max-age=86400,public header in the response. So the only reason left was the Cache-Control:max-age=0 header in the request. So I tried to change the header. I set the cache-control header in the request to be Cache-Control:max-age=86400,public, but still no luck.
The views are requested by AngualarJS, they are templates in directives. There is also a difference in the IIS version that we are using locally and that on the server. Locally we are using 7.5 and on the server, it is 8.0. Could this be the problem?
Can anyone guide me to the right direction?
Edit:
The Disable Cache option in the chrome dev tools is disabled.
One thing I can think about is that you have the Disable Cache enabled in your browser, if it's just your local system:
Normally, getting around Browser caching is quite tricky, so most people have trouble disabling browser caching using headers. The Cache-Control:max-age unfortunately is not uniformly implemented across browsers. If the issue is still occurring inspite of the above, could you provide screenshots from the network tab on your Chrome developer tools?

Strange Behavior of $http/Ajax Calls on Windows Phone 8.1 App

I have been recently stuck into a strange issue, thrown by a Multi platform Hybrid App in Visual Studio App.. My Development Environment details are as follows :
Visual Studio 2013 Release 3
Cordova 4.0
Angularjs 1.4
Ionic 1.4
Nokia Lumia 1320 [Windows 8.1 OS]
I have a web app that will be interacting with the mobile app, deployed on a server machine that can be accessed both by an internal enterprise network, as well as from internet.
Now the problem is, when i am [the mobile device is] connected to the internal network, the $http call fails with a status code of 0. Internal dig down reveals that the actual returned status code is -1.
However, when i switch over to mobile data in the phone, the ajax call goes smooth and finishes successfully. Now, if i switch back to internal network, it again starts working perfectly. !!!!
The http call is quite simple and uses promise API... I also have some request interceptors.
Any explanations for this strange behavior, or more appropriately a solution for the same ??
After Scratching my head for over 2 days, i was finally able to conclude that it was my browser that was the culprit.
As i said, i was using Windows Phone 8.1, which uses Internet Explorer 11 as the default rendered. Also, My Web server was actually behind a Proxy Server [Apache HTTP].
Now, the Real problem was that the ajax call was returning response status code as 0. And the reason for that was that The Ajax Call was being suspended by The Apache HTTP Proxy Server, because of some tunneling issue. Please note that this was specifically happening with IE11 and Apache HTTP Server.
This was happening since I was using POST request on a HTTPS Based Proxy Server.
Now the solution is too non-technical, but that's what saved my life. In order to save your life from this issue, You must
1. Either convert your POST Request to GET Request
2. Or Before making a POST Request to the Server, make a GET Request to the same server.
In my case, i went with the second approach and it saved my life. Posting this as answer so that it saves someone else too.
You can refer to the following links for more details.
IE10/IE11 Abort Post Ajax Request After Clearing Cache with error “Network Error 0x2ef3”
Making XHR Request to HTTPS domains with WinJS

Silverlight WSOD at remote client site

I have a client who installed our silverlight app recently. it works fine from their server itself. but when they try to run it from a client, they can log in through the aspx login page, but on the main page, which hosts the tag and the .xap file, they see absolutely nothing!
I cannot see their screens, just get occasional screenshots via email and cross my fingers that they are typing the URL I tell them to. Even Shareview is not working for them - they can see my screen but I cannot see theirs.
So I am pleading - help! Please throw out some wacky ideas. I just learned an hour or so ago that they did not even have silverlight installed, so the mornings debugging effort was a waste of time. So who knows what the next fascinating source of problems is?
Here is the user-agent info. Oor app is .net 4.0 could that be the problem? It does noty look to my untrained eye that the client supports 4.0 (from the web server log):
Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+5.1;+.NET+CLR+1.1.4322;+.NET+CLR+2.0.50727;+.NET+CLR+3.0.04506.30;+.NET+CLR+3.0.04506.648;+.NET+CLR+3.0.4506.2152;+.NET+CLR+3.5.30729) 401 3 5 0
Getting closer - I see that the GET request for the XAP is returning 401 - not found! What would do that?
It's very possible that they are blocking XAP files either directly or indirectly at the firewall. XAP files are simply ZIP files and inspection-based firewalls tend to look at these as a security risk. You may want to see if they can setup an exception in their rules.
Hmm..
1) check if your client access the good url. Request their IP address, then check the web server logs. ie: are they requesting the good url, are they downloading the xap? (check if they use a proxy, too?)
2) check that they restarted their browser after installing the Silverlight runtime.
3) Do you handle the UnhandledException event for your Application class? If no, use it to send detailed exception logs to your server on application crash.
4) Use javascriptto initialize your Silverlight application. This way, you can be notified if the runtime fail to start, (for example if it failed to load the xap file) You can use ajax to report the issue to the webserver.

Calling a https WCF-Service from Silverlight 4 only works with fiddler and from VS2010

for days now, I try to get the following scenario running:
I have a Silverlight 4 Application that calls a WCF-Service via HTTPS. The WCF-Service is located on one of our servers, the Silverlight 4 app is also served from this server. After several hours of trial and error (well actually more error than try) I get it running when starting it from my VS2010 development environment on my local machine (see also SecurityError when calling a HTTPS-WCF Service from Silverlight 4).
But ...
The call to the https-WCF ONLY works when I start the SL-App from my VS2010 AND when fiddler is running and after I tell fiddler to ignore the Certificate Error (I use a self-signed certificate). When fiddler is not running, I get a security error. That applies, when my browser is the IE. When I copy the localhost address from the IE and paste it in my opera, it works without fiddler.
When I deploy the Silverlight app to the server and call it from the server, the WCF-call doesn't work, whether fiddler is running or not. I just get the standard Message, that an exception has occurred. This happens in both Opera and IE. Fiddler doesn't ask me to ignore the Certificate Error like it does in the VS2010 scenario, so maybe there is somewhere the key to my problem. Unfortunately, I have not much experiences with this stuff, so I have no idea, where to look or what to do.
I already found something about the fiddler issue here on stackoverflow ( Silverlight Requests, Failures & Fiddler), but it doesn't help me solving my problem.
I hope that some of you can shed some light in this issue, before all my hair is turned to gray.
Thanks in advance,
Frank
Edith has just installed the Certificate as a trusted Certificate in IE - but I still get the error, when calling the WCF when starting the deployed silverlight app from the server. At least I can call the Service when I start the SL app from VS2010 in the IE now (even when that doesn't help me, when some one else has to work with the app.
Several thoughts:
What is the exact error message you're seeing? Any inner exceptions?
Could this be a cross-domain issue? (Are the Silverlight XAP and the WCF service hosted from exactly the same domain, including its HTTP vs HTTPS characteristic, port number, distinction between "localhost" and an actual machine name, etc? What is the exact address as it appears in ServiceReference.ClientConfig or in code, and does its domain name exactly match the XAP's domain name?)
Do you see any call attempting to go through in Fiddler at all when it fails? (If not, I would strongly suspect a cross-domain issue)
If you manually browse to the https://....../YourService.svc from IE/Opera (instead of invoking the service through code in Silverlight), can you successfully see the service information page, with no certificate warnings/errors?
Does your SSL certificate has the same name as your service host? If not, that causes an error which can lead to the described behavior

http request from Google App Engine

I'm trying to make http requests from my Google App Engine webapp, and discovered I have to use URLConnection since it's the only whitelisted class. The corresponding Clojure library is clojure.contrib.http.agent, and my code is as follows:
(defroutes example
(GET "/" [] (http/string (http/http-agent "http://www.example.com")))
(route/not-found "Page not found"))
This works fine in my development environment- the browser displays the text for example.com. But when I test it out with Google's development app server:
phrygian:example wei$ dev_appserver.sh war
2010-09-28 14:53:36.120 java[43845:903] [Java CocoaComponent compatibility mode]: Enabled
...
INFO: The server is running at http://localhost:8080/
It just hangs when I load the page. No error, or anything. Any idea what might be going on?
http-agent creates threads so that might be why it does not work.
From the API documentation:
Creates (and immediately returns) an Agent representing an HTTP
request running in a new thread.
You could try http-connection, which is a wrapper around HttpURLConnection, so this should work.
Another alternative is to try clj-http. The API seems to be a bit more high-level, but it uses Apache HttpComponents which might be blacklisted.
I am guessing http.async.client is a definite no-go due to its strong asynchronous approach.
You might want to try appengine.urlfetch/fetch from appengine-clj (http://github.com/r0man/appengine-clj, also in clojars)

Resources