Enterprise Library Logging and click once applications - wpf

We have a WPF application that logs exceptions (currently to a file) using Enterprise Library.
We are now planning to distribute this application using click once. If I have understood it correctly a click once application has limited access to the local harddisk.
So question is which location can Entlib write log entries to? Is there any special configuration required?

ClickOnce Apps support the concepts of Isolated Storage and Data Directory. See this SO Post and the MSDN. The log4net example in the SO post should guide you into the right direction.

Related

Utilising AppHarbour with a WPF application

I am investigating the best route for me to push updates of my small WPF application to my end users using ClickOnce.
I have looked briefly at AppHarbour and see that ASP.NET MVC works straight out of the box. Has anyone tried with a WPF application, or if there is a slicker/easier/cheaper way for me to publish my app to clients from a Web location?
Also if above is achievable/feasible does anyone have any advice for slickest continuous integration techniques with this approach? i.e. set up 2 environments on AppHarbour, QA/Production, set a test environment at client site pointing to QA and a live deployment on client site pointing to live etc...?
I will be using the (currently) freebie version of VisualStudio.com TFS for source control. I know Azure does this, and is incredibly simple to use but I am a pauper and have no funds for this until I sell a few more sites!
Thanks
You can host your ClickOnce deployment in Azure blob storage. You can write a small program that will deploy it after you publish it locally, or push it up manually using something like Cerebrata tools. It's really, really inexpensive. This article explains how to do it, and this article talks about the cost. The second article has old Azure pricing; it's even cheaper now.

What are the big major drawbacks porting a wpf LOB to silverlight 4

I am thinking about porting my alpha WPF MVVM application to silverlight.
I do not use 3D its a LOB ;-)
What I promise myself from the conversion is to get more customers in the end (Mac/nix user do not pay well ;P).
1.) At the moment I am using sqlite as database. Is it possible, that I can access the sqlite file on the harddisk of my user to read/save data? (on User dir its possible but access an USB stick ?)
2.) Is there anything concerning MVVM silverlight can not handle?
3.) Does SEO work well with Silverlight 4?
1.) At the moment I am using sqlite as database. Is it possible, that I can access the sqlite file on the harddisk of my user to read/save data? (on User dir its possible but access an USB stick ?)
If you want to use a local database then you'll either need to install your Silverlight application on the local machine as a full trust application or use a database that installs into Isolated Storage like SiaqoDb (as suggested by #Shawn Mclean). You won't be able to access a USB stick.
When run in a browser across the net it has limited access to the local hard drive for security reasons. If you're doing this you might as well stick with WPF.
2.) Is there anything concerning MVVM silverlight can not handle?
You can use Prism to develop MVVM applications for Silverlight as well as WPF.
3.) Does SEO work well with Silverlight 4?
I don't know a great deal about this, but Silverlight can be viewed as Microsoft's version of Flash so it will probably have the same SEO issues as Flash. The code is compiled and delivered to the client in binary form, so unless you split your application across multiple HTML/ASP.NET pages there won't be anything for Google to index. Apparently Flash does support SEO, but I haven't looked into SEO and Silverlight.
1.) At the moment I am using sqlite as database. Is it possible, that I can access the sqlite file on the harddisk of my user to read/save data? (on User dir its possible but access an USB stick ?)
The basic principal of Silverlight is centralised data over services. You can have local data, but that is not as useful generally compared to a central storage. You then have no worries about full trust as it will run in any Silverlight browser.
You can use SQLLite on your server, however the best free database option we have found is SQL Service Express 2008 R2.
You can access USB, but it requires both OOB, Full Trust and a custom COM automation object installed on the client (so Windows only). Basically forget local USB storage and support downloads instead, if local copies are needed.
2.) Is there anything concerning MVVM silverlight can not handle?
Bindings in Silverlight 4 are now very similar to those in WFP. Accessing parent elements from templates is a little more difficult, but most simple bindings are the same.
3.) Does SEO work well with Silverlight 4?
First ensure that you provide a sitemap for the searchengines. That should map to all content pages.
Provide a parallel ASP.Net website to publish your content for the search engines to read. This is now quite easy with RIA services as an ASP.Net website can consume a RIA service just like any other WCF service.
Make good use of headers, meta tags, titles, human-readable urls to include relevant keywords.

Silverlight and Full Trust Issue

We are planning to build a new integration component that can provide us access to user's machine installed apps from our web site.
The first word that came to me was ActiveX, but our expertise with the technology was not the best in the past.
Thinkink a lit bit more, the work Silverlight also came to my head, but the full trust thing was one of the few things I remembered reading about the technology..
The question is: is there a way that Silverlight (2, 3, 4, whatever) can run as a full trusted application from within the browser?
Links are appreciated.
Filipe
Unfortunately, no. Full trust is a feature of Silverlight 4, currently in beta, and is restricted to out-of-browser applications.
Additionally, full trust SL4 applications do not have unrestricted access to the system (particularly file system), though this may change before before release (if I have anything to do with it).
Edit: If you are considering ActiveX (which is Windows/IE only), you might want to have a look at WPF, since it can run full trust from the browser (if it's in a trusted zone).
No, like Richard said, this is not at all possible inside the browser, even in SL4. There is a sandbox, and you live in it. You can talk to web services, other Silverlight applications or the browser.
By talking to the browser, I mean you can talk to the DOM and the Javascript engine. We needed to launch a Windows application and communicate to it via Silverlight. We accomplished this by putting a small ActiveX control in the web page. It is responsible for launching the WinForms application and handling inter-process communication to it.
This method has many drawbacks: It can only work in IE, and it only works in Windows. You might also run into permissions issues. The ActiveX component needs to be installed along with the desktop application, or as an additional download. The deployment story there is pretty awful, if you ask me.
In our case, the analysts were willing to deal with the restrictions for the re-usability of an existing application, and we consider it to be an optional feature.
Does it have to be a web application? sounds like you want a desktop app. It can be easiliy distributed with one Click deployment. Will work on windows only but since you were considering ActiveX sounds like that's what you need.
Well - if you're hosting the silverlight control from an ASP.NET application - Believe you have access to
Request.ServerVariables["AUTH_USER"];
...and you can pass that on to your control as a parameter.
D

How do I run a Full Trust XBAP on intranet?

I've made a WPF Browser Application that hosts old WinForms controls (I haven't migrated fully to WPF yet). Using WindowsFormsHost means my Browser App requires Full Trust to run. This is not a problem for me since this app is only meant to be run on the intranet at my company. However, after I deploy the xbap to a network share, it refuses to run, saying "Trust not granted".
What are the methods I can use to grant Full Trust to XBAP applications stored on my companies intranet?
So far, I've found 2 ways to do this. Through a really complicated method of installing certificates on the target machine.
Or through a simpler method, which is only suitable for intranets here:
Deploy a custom CLR Security policy
that modifies the default
permissionset for the given zone
So I did just that, and it works. Here's the detailed steps how I got it to work:
Open Control Panel > Administrative Tools > .NET Framework 2.0 Configuration
Expand Runtime Security Policy > Machine > Code Groups > All_Code
Right Click All_Code and click New…
Create a new code group, I named mine MyProject_FullTrust_Zone
Choose the URL condition type and specify the path on the network where the apps will be deployed.
Choose Use Existing permission set, and set it to Full Trust.
Now the only problem with this method, is that I have to deploy this change to hundreds of machines. So maybe there's still a simpler way to do this?
It will be possible in .Net 4.0 planning to be released in the first half of 2010. It is now in a beta phase, but it comes with a go live license which allows you to 'go live' even with a beta version of the .Net framework.
Although I haven't tried this, is the path to the XBAP added as a trusted site?

Using Logging from Microsoft Application Block with WPF

I have a WPF application and I want to use the Microsoft Application Block for logging (MIcrosoft.Practices.EnterpriseLibrary.Logging)
How can I configure it in order to work?
It depends where and how you want to persist the log data.
Download the enterprise lib 4.1 from
http://msdn.microsoft.com/en-us/library/dd203099.aspx
There is quick start for logging. The app.config within the sample is what you are after.
You shouldn't have to make much change from it in order to make your WPF logging works.
FYI there's nothing special about using EntLib with a WPF application versus a WinForms or server application (assuming you're not launching forms for visual tracing).
MSDN has a document on this that should answer you question:
Integrating the Logging Application Block with WCF Applications
http://msdn.microsoft.com/en-us/library/ff648685.aspx

Resources