<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" version="2.0">
  <channel>
    <title>Rockford Lhotka - WCF</title>
    <link>http://www.lhotka.net/weblog/</link>
    <description>Creator of the CSLA .NET framework</description>
    <language>en-us</language>
    <copyright>Marimer LLC</copyright>
    <lastBuildDate>Thu, 28 Apr 2011 23:46:57 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.0.7226.0</generator>
    <managingEditor>rocky@lhotka.net</managingEditor>
    <webMaster>rocky@lhotka.net</webMaster>
    <item>
      <trackback:ping>http://www.lhotka.net/weblog/Trackback.aspx?guid=9855a23e-59dd-4182-baf6-b789070e7183</trackback:ping>
      <pingback:server>http://www.lhotka.net/weblog/pingback.aspx</pingback:server>
      <pingback:target>http://www.lhotka.net/weblog/PermaLink,guid,9855a23e-59dd-4182-baf6-b789070e7183.aspx</pingback:target>
      <dc:creator>Rockford Lhotka</dc:creator>
      <wfw:comment>http://www.lhotka.net/weblog/CommentView,guid,9855a23e-59dd-4182-baf6-b789070e7183.aspx</wfw:comment>
      <wfw:commentRss>http://www.lhotka.net/weblog/SyndicationService.asmx/GetEntryCommentsRss?guid=9855a23e-59dd-4182-baf6-b789070e7183</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Today I spent hours trying to make one line of code work. Fortunately <a href="http://dotnetdude.com/">Miguel
Castro</a> was ultimately able to help me troubleshoot the issue thanks to his deep
understanding of all things ASP.NET.
</p>
        <p>
The line of code seems so simple:
</p>
        <blockquote>
          <p>
var data = Roles.GetRolesForUser(“rocky”);
</p>
        </blockquote>
        <p>
In this case <em>Roles</em> is the RoleProvider API from System.Web.Security, and
the method returns a string array with the roles for the user.
</p>
        <p>
This line of code works great in my aspx page. No problem at all.
</p>
        <p>
But <em>in the same web project</em> it throws a NullReferenceException when called
from a WCF service (in a svc).
</p>
        <p>
No stack trace. No detail. No nothing. I Binged, and Googled, and created a whole
new solution (figuring my first solution was somehow corrupted). But nothing helped.
</p>
        <p>
To cut to the answer, this works in a WCF service:
</p>
        <blockquote>
          <p>
var data = Roles.Provider.GetRolesForUser(“rocky”);
</p>
        </blockquote>
        <p>
See the difference? Instead of relying on the static helper method on the Roles type,
this code explicitly calls the method on the default provider instance.
</p>
        <p>
(fwiw, I think this behavior is relatively new, because that code <em>used to work</em>.
I just don’t remember how long ago it was that it worked – .NET 3 or 3.5 – so perhaps
something broke in .NET 4?)
</p>
        <p>
In any case, problem solved – thanks Miguel!!
</p>
        <img width="0" height="0" src="http://www.lhotka.net/weblog/aggbug.ashx?id=9855a23e-59dd-4182-baf6-b789070e7183" />
      </body>
      <title>Calling Roles.GetRolesForUser in a WCF service</title>
      <guid isPermaLink="false">http://www.lhotka.net/weblog/PermaLink,guid,9855a23e-59dd-4182-baf6-b789070e7183.aspx</guid>
      <link>http://www.lhotka.net/weblog/CallingRolesGetRolesForUserInAWCFService.aspx</link>
      <pubDate>Thu, 28 Apr 2011 23:46:57 GMT</pubDate>
      <description>&lt;p&gt;
Today I spent hours trying to make one line of code work. Fortunately &lt;a href="http://dotnetdude.com/"&gt;Miguel
Castro&lt;/a&gt; was ultimately able to help me troubleshoot the issue thanks to his deep
understanding of all things ASP.NET.
&lt;/p&gt;
&lt;p&gt;
The line of code seems so simple:
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
var data = Roles.GetRolesForUser(“rocky”);
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
In this case &lt;em&gt;Roles&lt;/em&gt; is the RoleProvider API from System.Web.Security, and
the method returns a string array with the roles for the user.
&lt;/p&gt;
&lt;p&gt;
This line of code works great in my aspx page. No problem at all.
&lt;/p&gt;
&lt;p&gt;
But &lt;em&gt;in the same web project&lt;/em&gt; it throws a NullReferenceException when called
from a WCF service (in a svc).
&lt;/p&gt;
&lt;p&gt;
No stack trace. No detail. No nothing. I Binged, and Googled, and created a whole
new solution (figuring my first solution was somehow corrupted). But nothing helped.
&lt;/p&gt;
&lt;p&gt;
To cut to the answer, this works in a WCF service:
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
var data = Roles.Provider.GetRolesForUser(“rocky”);
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
See the difference? Instead of relying on the static helper method on the Roles type,
this code explicitly calls the method on the default provider instance.
&lt;/p&gt;
&lt;p&gt;
(fwiw, I think this behavior is relatively new, because that code &lt;em&gt;used to work&lt;/em&gt;.
I just don’t remember how long ago it was that it worked – .NET 3 or 3.5 – so perhaps
something broke in .NET 4?)
&lt;/p&gt;
&lt;p&gt;
In any case, problem solved – thanks Miguel!!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.lhotka.net/weblog/aggbug.ashx?id=9855a23e-59dd-4182-baf6-b789070e7183" /&gt;</description>
      <comments>http://www.lhotka.net/weblog/CommentView,guid,9855a23e-59dd-4182-baf6-b789070e7183.aspx</comments>
      <category>WCF</category>
      <category>Web</category>
    </item>
    <item>
      <trackback:ping>http://www.lhotka.net/weblog/Trackback.aspx?guid=fd8a5ae9-4570-4422-8c17-589d633b23b2</trackback:ping>
      <pingback:server>http://www.lhotka.net/weblog/pingback.aspx</pingback:server>
      <pingback:target>http://www.lhotka.net/weblog/PermaLink,guid,fd8a5ae9-4570-4422-8c17-589d633b23b2.aspx</pingback:target>
      <dc:creator>Rockford Lhotka</dc:creator>
      <wfw:comment>http://www.lhotka.net/weblog/CommentView,guid,fd8a5ae9-4570-4422-8c17-589d633b23b2.aspx</wfw:comment>
      <wfw:commentRss>http://www.lhotka.net/weblog/SyndicationService.asmx/GetEntryCommentsRss?guid=fd8a5ae9-4570-4422-8c17-589d633b23b2</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Yesterday I set out to do “something simple” – to use Windows Server AppFabric to
do basic health monitoring of a WCF service.
</p>
        <p>
A few hours later, I was pulling my hair out and my brain was spinning.
</p>
        <p>
The basic issue is that configuring and using AppFabric involves numerous moving parts,
and that leads to a ton of complexity for something that is otherwise pretty simple.
But there are a lot of moving parts:
</p>
        <ol>
          <li>
My app</li>
          <li>
IIS</li>
          <li>
ASP.NET</li>
          <li>
WCF</li>
          <li>
AppFabric configuration tool</li>
          <li>
AppFabric Dashboard</li>
          <li>
AppFabric event collection service</li>
          <li>
SQL Server</li>
          <li>
SQL Server Agent</li>
          <li>
Machine.config</li>
          <li>
Web.config</li>
          <li>
Visual Studio</li>
          <li>
NTFS security</li>
        </ol>
        <p>
To make matters worse, on my dev workstation I had SQL Express 2005, SQL Express 2008
R2, and SQL Server 2008.
</p>
        <p>
What you are <em>supposed</em> to do is simply this:
</p>
        <ol>
          <li>
install your web site into IIS (create an IIS Application where the virtual root points
to your web site directory)</li>
          <li>
in IIS Manager go to the virtual root, and click the Configure link on the far right
under the Manage WCF and WF Services label</li>
          <li>
in the resulting dialog, click Monitoring on the left, then enable application monitoring</li>
          <li>
call your service</li>
          <li>
back in IIS Manager, double-click the AppFabric Dashboard option for your virtual
root to see the dashboard, with the cute little counters showing that your services
have been used</li>
        </ol>
        <p>
Of course that didn’t work.
</p>
        <p>
In the end, I <em>think</em> it didn’t work because the AppFabric Event Collection
Service (a Windows service that runs to collect event information) didn’t have NTFS
security rights to read my application’s web.config file.
</p>
        <p>
But that’s not the first thing I thought to check. No, the first thing I thought to
check was whether data was getting into the AppFabric tables in SQL Server. It was
not. So then (after a little googling with Bing), it sounded like the problem was
that SQL Agent wasn’t running.
</p>
        <p>
Of course it turns out that SQL Agent can’t run against SQL Express. But having three
different versions of SQL Server installed was making this all very hard to troubleshoot.
So I spent some quality time uninstalling SQL 2005 and 2008, and then installing SQL
Server Developer 2008 R2 – so now I have a real up-to-date SQL Server instance where
SQL Agent does work.
</p>
        <p>
(again, I suspect that was all wasted time – but on the upside, I have a far less
confusing SQL Server installation <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://www.lhotka.net/weblog/content/binary/Windows-Live-Writer/Windows-Server-AppFabric-and-WCF-monitor_8BCD/wlEmoticon-smile_2.png" /> )
</p>
        <p>
All that work, and it didn’t help. Then it occurred to me that my configurations were
probably out of sync. So I reconfigured AppFabric, and my app, and the web sites and
virtual roots in IIS Manager – all to use the new 2008 R2 database. And things were
out of sync, so this was necessary and good.
</p>
        <p>
But that didn’t help either. Still no data was in the AppFabric database.
</p>
        <p>
Finally, I found a <a href="http://msdn.microsoft.com/en-us/library/ee677384.aspx">page
lurking deep in MSDN</a> that contained good troubleshooting information. And in here
were instructions on how to view the event log for the AppFabric event collection
service – which couldn’t read my web.config file.
</p>
        <p>
I thought I’d hit the jackpot, so I updated the NTFS permissions on my web folder
so the collection service could read the directory.
</p>
        <p>
Still nothing. So I went to bed, frustrated at the continual failure.
</p>
        <p>
This morning I thought I’d try again. Still no joy. So I rebooted my machine, and
then it worked.
</p>
        <p>
So I suspect that the core issue was the NTFS file permissions for the collection
service. But with all the other changes I made, some service didn’t re-read its configuration
until the system was rebooted.
</p>
        <p>
In the end, it only took me about 6 hours of work to get Windows Server AppFabric
to monitor the health of my WCF service. Hopefully I’ll never have to go through that
again…
</p>
        <img width="0" height="0" src="http://www.lhotka.net/weblog/aggbug.ashx?id=fd8a5ae9-4570-4422-8c17-589d633b23b2" />
      </body>
      <title>Windows Server AppFabric and WCF monitoring</title>
      <guid isPermaLink="false">http://www.lhotka.net/weblog/PermaLink,guid,fd8a5ae9-4570-4422-8c17-589d633b23b2.aspx</guid>
      <link>http://www.lhotka.net/weblog/WindowsServerAppFabricAndWCFMonitoring.aspx</link>
      <pubDate>Tue, 22 Mar 2011 15:13:40 GMT</pubDate>
      <description>&lt;p&gt;
Yesterday I set out to do “something simple” – to use Windows Server AppFabric to
do basic health monitoring of a WCF service.
&lt;/p&gt;
&lt;p&gt;
A few hours later, I was pulling my hair out and my brain was spinning.
&lt;/p&gt;
&lt;p&gt;
The basic issue is that configuring and using AppFabric involves numerous moving parts,
and that leads to a ton of complexity for something that is otherwise pretty simple.
But there are a lot of moving parts:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
My app&lt;/li&gt;
&lt;li&gt;
IIS&lt;/li&gt;
&lt;li&gt;
ASP.NET&lt;/li&gt;
&lt;li&gt;
WCF&lt;/li&gt;
&lt;li&gt;
AppFabric configuration tool&lt;/li&gt;
&lt;li&gt;
AppFabric Dashboard&lt;/li&gt;
&lt;li&gt;
AppFabric event collection service&lt;/li&gt;
&lt;li&gt;
SQL Server&lt;/li&gt;
&lt;li&gt;
SQL Server Agent&lt;/li&gt;
&lt;li&gt;
Machine.config&lt;/li&gt;
&lt;li&gt;
Web.config&lt;/li&gt;
&lt;li&gt;
Visual Studio&lt;/li&gt;
&lt;li&gt;
NTFS security&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
To make matters worse, on my dev workstation I had SQL Express 2005, SQL Express 2008
R2, and SQL Server 2008.
&lt;/p&gt;
&lt;p&gt;
What you are &lt;em&gt;supposed&lt;/em&gt; to do is simply this:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
install your web site into IIS (create an IIS Application where the virtual root points
to your web site directory)&lt;/li&gt;
&lt;li&gt;
in IIS Manager go to the virtual root, and click the Configure link on the far right
under the Manage WCF and WF Services label&lt;/li&gt;
&lt;li&gt;
in the resulting dialog, click Monitoring on the left, then enable application monitoring&lt;/li&gt;
&lt;li&gt;
call your service&lt;/li&gt;
&lt;li&gt;
back in IIS Manager, double-click the AppFabric Dashboard option for your virtual
root to see the dashboard, with the cute little counters showing that your services
have been used&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
Of course that didn’t work.
&lt;/p&gt;
&lt;p&gt;
In the end, I &lt;em&gt;think&lt;/em&gt; it didn’t work because the AppFabric Event Collection
Service (a Windows service that runs to collect event information) didn’t have NTFS
security rights to read my application’s web.config file.
&lt;/p&gt;
&lt;p&gt;
But that’s not the first thing I thought to check. No, the first thing I thought to
check was whether data was getting into the AppFabric tables in SQL Server. It was
not. So then (after a little googling with Bing), it sounded like the problem was
that SQL Agent wasn’t running.
&lt;/p&gt;
&lt;p&gt;
Of course it turns out that SQL Agent can’t run against SQL Express. But having three
different versions of SQL Server installed was making this all very hard to troubleshoot.
So I spent some quality time uninstalling SQL 2005 and 2008, and then installing SQL
Server Developer 2008 R2 – so now I have a real up-to-date SQL Server instance where
SQL Agent does work.
&lt;/p&gt;
&lt;p&gt;
(again, I suspect that was all wasted time – but on the upside, I have a far less
confusing SQL Server installation &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://www.lhotka.net/weblog/content/binary/Windows-Live-Writer/Windows-Server-AppFabric-and-WCF-monitor_8BCD/wlEmoticon-smile_2.png" /&gt; )
&lt;/p&gt;
&lt;p&gt;
All that work, and it didn’t help. Then it occurred to me that my configurations were
probably out of sync. So I reconfigured AppFabric, and my app, and the web sites and
virtual roots in IIS Manager – all to use the new 2008 R2 database. And things were
out of sync, so this was necessary and good.
&lt;/p&gt;
&lt;p&gt;
But that didn’t help either. Still no data was in the AppFabric database.
&lt;/p&gt;
&lt;p&gt;
Finally, I found a &lt;a href="http://msdn.microsoft.com/en-us/library/ee677384.aspx"&gt;page
lurking deep in MSDN&lt;/a&gt; that contained good troubleshooting information. And in here
were instructions on how to view the event log for the AppFabric event collection
service – which couldn’t read my web.config file.
&lt;/p&gt;
&lt;p&gt;
I thought I’d hit the jackpot, so I updated the NTFS permissions on my web folder
so the collection service could read the directory.
&lt;/p&gt;
&lt;p&gt;
Still nothing. So I went to bed, frustrated at the continual failure.
&lt;/p&gt;
&lt;p&gt;
This morning I thought I’d try again. Still no joy. So I rebooted my machine, and
then it worked.
&lt;/p&gt;
&lt;p&gt;
So I suspect that the core issue was the NTFS file permissions for the collection
service. But with all the other changes I made, some service didn’t re-read its configuration
until the system was rebooted.
&lt;/p&gt;
&lt;p&gt;
In the end, it only took me about 6 hours of work to get Windows Server AppFabric
to monitor the health of my WCF service. Hopefully I’ll never have to go through that
again…
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.lhotka.net/weblog/aggbug.ashx?id=fd8a5ae9-4570-4422-8c17-589d633b23b2" /&gt;</description>
      <comments>http://www.lhotka.net/weblog/CommentView,guid,fd8a5ae9-4570-4422-8c17-589d633b23b2.aspx</comments>
      <category>Microsoft .NET</category>
      <category>WCF</category>
    </item>
    <item>
      <trackback:ping>http://www.lhotka.net/weblog/Trackback.aspx?guid=89d338dc-9021-45b3-9c53-839762ea0b5d</trackback:ping>
      <pingback:server>http://www.lhotka.net/weblog/pingback.aspx</pingback:server>
      <pingback:target>http://www.lhotka.net/weblog/PermaLink,guid,89d338dc-9021-45b3-9c53-839762ea0b5d.aspx</pingback:target>
      <dc:creator>Rockford Lhotka</dc:creator>
      <wfw:comment>http://www.lhotka.net/weblog/CommentView,guid,89d338dc-9021-45b3-9c53-839762ea0b5d.aspx</wfw:comment>
      <wfw:commentRss>http://www.lhotka.net/weblog/SyndicationService.asmx/GetEntryCommentsRss?guid=89d338dc-9021-45b3-9c53-839762ea0b5d</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Of course I’m referring to Windows Forms, which is about 8 years old. Even in dog
years that’s not old. But in <em>software years</em> it is pretty old I’m afraid…
</p>
        <p>
I’m writing this post because here and in other venues I’ve recently referred to Windows
Forms as “legacy”, along with asmx and even possibly Web Forms. This has caused a
certain amount of alarm, but I’m not here to apologize or mollify.
</p>
        <p>
Technologies come and go. That’s just life in our industry. I was a DEC VAX guy for
many years (I hear Ted Neward laughing now, he loves these stories), but I could see
the end coming years before it faded away, so I switched to the woefully immature
Windows platform (Windows 3.0 – what a step backward from the VAX!). I know many FoxPro
people who transitioned, albeit painfully, to VB or other tools/languages. The same
with Clipper/dBase/etc. Most PowerBuilder people transitioned to Java or .NET (though
much to my surprise I recently learned that PowerBuilder still actually exists – like
you can still buy it!!).
</p>
        <p>
All through my career I’ve been lucky or observant enough to jump ship before any
technology came down on my head. I switched to Windows before the VAX collapsed, and
switched to .NET before VB6 collapsed, etc. And honestly I can’t think of a case where
I didn’t feel like I was stepping back in time to use the “new technology” because
it was so immature compared to the old stuff. But every single time it was worth the
effort, because I avoided being trapped on a slowly fading platform/technology with
my skills becoming less relevant every day.
</p>
        <p>
But what is “legacy”? I once heard a consultant say “legacy is anything you’ve put
in production”. Which might be good for a laugh, but isn’t terribly useful in any
practical sense.
</p>
        <p>
I think “legacy” refers to a technology or platform that is no longer an area of focus
or investment by the creator/maintainer. In our world that mostly means Microsoft,
and so the question is where is Microsoft focused, where are they spending their money
and what are they enhancing?
</p>
        <p>
The answers are pretty clear:
</p>
        <ul>
          <li>
Azure</li>
          <li>
Silverlight</li>
          <li>
ASP.NET MVC</li>
          <li>
WPF (to a lesser degree)</li>
          <li>
ADO.NET EF</li>
          <li>
WCF</li>
        </ul>
        <p>
These are the areas where the research, development, marketing and general energy
are all focused. Ask a Microsoft guy what’s cool or hot and you’ll hear about Azure
or Silverlight, maybe ADO.NET EF or ASP.NET MVC and possibly WPF or WCF. But you won’t
hear Windows Forms, Web Forms, asmx web services, Enterprise Services, Remoting, LINQ
to SQL, DataSet/TableAdapter/DataTable or numerous other technologies.
</p>
        <p>
Some of those other technologies aren’t legacy – they aren’t going away, they just
aren’t sexy. Raw ADO.NET, for example. Nobody talks about that, but ADO.NET EF can’t
exist without it, so it is safe. But in theory ADO.NET EF competes with the DataSet
(poorly, but still) and so the DataSet is a strong candidate for the “legacy” label.
</p>
        <p>
Silverlight and WPF both compete with Windows Forms. Poor Windows Forms is getting
no love, no meaningful enhancements or new features. It is just there. At the same
time, Silverlight gets a new release in less than 12 month cycles, and WPF gets all
sorts of amazingly cool new features for Windows 7. You tell me whether Windows Forms
is legacy. But whatever you decide, I’m surely spending zero cycles of my time on
it.
</p>
        <p>
asmx is obvious legacy too. Has been ever since WCF showed up, though WCF’s configuration
issues have been a plague on its existence. I rather suspect .NET 4.0 will address
those shortcomings though, making WCF as easy to use as asmx and driving the final
nail in the asmx coffin.
</p>
        <p>
Web Forms isn’t so clear to me. All the buzz is on ASP.NET MVC. That’s the technology
all the cool kids are using, and it really is some nice technology – I like it as
much as I’ll probably ever like a web technology. But if you look at .NET 4.0, Microsoft
has done some really nice things in Web Forms. So while it isn’t getting the hype
of MVC, it is still getting some very real love from the Microsoft development group
that owns the technology. So I don’t think Web Forms is legacy now or in .NET 4.0,
but beyond that it is hard to say. I strongly suspect the fate of Web Forms lies mostly
in its user base and whether they fight for it, whether they make Microsoft believe
it continues to be worth serious investment and improvement into the .NET 5.0 timeframe.
</p>
        <p>
For my part, I can tell you that it is amazingly (impossibly?) time-consuming to be
an expert on 7-9 different interface technologies (UI, service, workflow, etc). Sure
CSLA .NET supports <em>all of them</em>, but there are increasing tensions between
the stagnant technologies (most notably Windows Forms) and the vibrant technologies
like Silverlight and WPF. It is no longer possible, for example, to create a collection
object that works with all the interface technologies – you just can’t do it. And
the time needed to deeply understand the different binding models and subtle differences
grows with each release of .NET.
</p>
        <p>
CSLA .NET 4.0 will absolutely still support all the interface technologies. But it
would be foolish to cut off the future to protect the past – that way lies doom. So
in CSLA .NET 4.0 you should expect to see support for Windows Forms still there, but
probably moved into another namespace (Csla.Windows or something), while the main
Csla namespace provides support for modern interface technologies like WPF, ASP.NET
MVC, Silverlight, etc.
</p>
        <p>
I am absolutely committed to providing a window of time where Windows Forms users
can migrate their apps to WPF or Silverlight while still enjoying the value of CSLA
.NET. And I really hope to make that reasonably smooth – ideally you’ll just have
to change your base class types for your business objects when you switch the UI for
the object from Windows Forms to XAML – though I suspect other minor tweaks may be
necessary as well in some edge cases.
</p>
        <p>
But let’s face it, at some point CSLA .NET does have to drop legacy technologies.
I’m just one guy, and even with Magenic being such a great patron it isn’t realistic
to support every technology ever invented for .NET :)  I don’t think the time
to drop Windows Forms is in 4.0, because there are way too many people who need to
migrate to WPF over the next 2-3 years.
</p>
        <p>
On the other hand, if you and your organization aren’t developing a strategy to move
off Windows Forms in the next few years I suspect you’ll eventually wake up one day
and realize you are in a bad spot. One of those spots where you can’t hire anyone
because no one else has done your technology for years, and nobody really remembers
how it works (or at least won’t admit they do unless you offer them huge sums of money).
</p>
        <p>
I don’t see this as bad. People who want stability shouldn’t be in computing. They
should be in something like accounts receivable or accounts payable – parts of business
that haven’t changed substantially for decades, or perhaps centuries.
</p>
        <img width="0" height="0" src="http://www.lhotka.net/weblog/aggbug.ashx?id=89d338dc-9021-45b3-9c53-839762ea0b5d" />
      </body>
      <title>It is only 8, how can it be legacy???</title>
      <guid isPermaLink="false">http://www.lhotka.net/weblog/PermaLink,guid,89d338dc-9021-45b3-9c53-839762ea0b5d.aspx</guid>
      <link>http://www.lhotka.net/weblog/ItIsOnly8HowCanItBeLegacy.aspx</link>
      <pubDate>Thu, 05 Nov 2009 03:20:16 GMT</pubDate>
      <description>&lt;p&gt;
Of course I’m referring to Windows Forms, which is about 8 years old. Even in dog
years that’s not old. But in &lt;em&gt;software years&lt;/em&gt; it is pretty old I’m afraid…
&lt;/p&gt;
&lt;p&gt;
I’m writing this post because here and in other venues I’ve recently referred to Windows
Forms as “legacy”, along with asmx and even possibly Web Forms. This has caused a
certain amount of alarm, but I’m not here to apologize or mollify.
&lt;/p&gt;
&lt;p&gt;
Technologies come and go. That’s just life in our industry. I was a DEC VAX guy for
many years (I hear Ted Neward laughing now, he loves these stories), but I could see
the end coming years before it faded away, so I switched to the woefully immature
Windows platform (Windows 3.0 – what a step backward from the VAX!). I know many FoxPro
people who transitioned, albeit painfully, to VB or other tools/languages. The same
with Clipper/dBase/etc. Most PowerBuilder people transitioned to Java or .NET (though
much to my surprise I recently learned that PowerBuilder still actually exists – like
you can still buy it!!).
&lt;/p&gt;
&lt;p&gt;
All through my career I’ve been lucky or observant enough to jump ship before any
technology came down on my head. I switched to Windows before the VAX collapsed, and
switched to .NET before VB6 collapsed, etc. And honestly I can’t think of a case where
I didn’t feel like I was stepping back in time to use the “new technology” because
it was so immature compared to the old stuff. But every single time it was worth the
effort, because I avoided being trapped on a slowly fading platform/technology with
my skills becoming less relevant every day.
&lt;/p&gt;
&lt;p&gt;
But what is “legacy”? I once heard a consultant say “legacy is anything you’ve put
in production”. Which might be good for a laugh, but isn’t terribly useful in any
practical sense.
&lt;/p&gt;
&lt;p&gt;
I think “legacy” refers to a technology or platform that is no longer an area of focus
or investment by the creator/maintainer. In our world that mostly means Microsoft,
and so the question is where is Microsoft focused, where are they spending their money
and what are they enhancing?
&lt;/p&gt;
&lt;p&gt;
The answers are pretty clear:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Azure&lt;/li&gt;
&lt;li&gt;
Silverlight&lt;/li&gt;
&lt;li&gt;
ASP.NET MVC&lt;/li&gt;
&lt;li&gt;
WPF (to a lesser degree)&lt;/li&gt;
&lt;li&gt;
ADO.NET EF&lt;/li&gt;
&lt;li&gt;
WCF&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
These are the areas where the research, development, marketing and general energy
are all focused. Ask a Microsoft guy what’s cool or hot and you’ll hear about Azure
or Silverlight, maybe ADO.NET EF or ASP.NET MVC and possibly WPF or WCF. But you won’t
hear Windows Forms, Web Forms, asmx web services, Enterprise Services, Remoting, LINQ
to SQL, DataSet/TableAdapter/DataTable or numerous other technologies.
&lt;/p&gt;
&lt;p&gt;
Some of those other technologies aren’t legacy – they aren’t going away, they just
aren’t sexy. Raw ADO.NET, for example. Nobody talks about that, but ADO.NET EF can’t
exist without it, so it is safe. But in theory ADO.NET EF competes with the DataSet
(poorly, but still) and so the DataSet is a strong candidate for the “legacy” label.
&lt;/p&gt;
&lt;p&gt;
Silverlight and WPF both compete with Windows Forms. Poor Windows Forms is getting
no love, no meaningful enhancements or new features. It is just there. At the same
time, Silverlight gets a new release in less than 12 month cycles, and WPF gets all
sorts of amazingly cool new features for Windows 7. You tell me whether Windows Forms
is legacy. But whatever you decide, I’m surely spending zero cycles of my time on
it.
&lt;/p&gt;
&lt;p&gt;
asmx is obvious legacy too. Has been ever since WCF showed up, though WCF’s configuration
issues have been a plague on its existence. I rather suspect .NET 4.0 will address
those shortcomings though, making WCF as easy to use as asmx and driving the final
nail in the asmx coffin.
&lt;/p&gt;
&lt;p&gt;
Web Forms isn’t so clear to me. All the buzz is on ASP.NET MVC. That’s the technology
all the cool kids are using, and it really is some nice technology – I like it as
much as I’ll probably ever like a web technology. But if you look at .NET 4.0, Microsoft
has done some really nice things in Web Forms. So while it isn’t getting the hype
of MVC, it is still getting some very real love from the Microsoft development group
that owns the technology. So I don’t think Web Forms is legacy now or in .NET 4.0,
but beyond that it is hard to say. I strongly suspect the fate of Web Forms lies mostly
in its user base and whether they fight for it, whether they make Microsoft believe
it continues to be worth serious investment and improvement into the .NET 5.0 timeframe.
&lt;/p&gt;
&lt;p&gt;
For my part, I can tell you that it is amazingly (impossibly?) time-consuming to be
an expert on 7-9 different interface technologies (UI, service, workflow, etc). Sure
CSLA .NET supports &lt;em&gt;all of them&lt;/em&gt;, but there are increasing tensions between
the stagnant technologies (most notably Windows Forms) and the vibrant technologies
like Silverlight and WPF. It is no longer possible, for example, to create a collection
object that works with all the interface technologies – you just can’t do it. And
the time needed to deeply understand the different binding models and subtle differences
grows with each release of .NET.
&lt;/p&gt;
&lt;p&gt;
CSLA .NET 4.0 will absolutely still support all the interface technologies. But it
would be foolish to cut off the future to protect the past – that way lies doom. So
in CSLA .NET 4.0 you should expect to see support for Windows Forms still there, but
probably moved into another namespace (Csla.Windows or something), while the main
Csla namespace provides support for modern interface technologies like WPF, ASP.NET
MVC, Silverlight, etc.
&lt;/p&gt;
&lt;p&gt;
I am absolutely committed to providing a window of time where Windows Forms users
can migrate their apps to WPF or Silverlight while still enjoying the value of CSLA
.NET. And I really hope to make that reasonably smooth – ideally you’ll just have
to change your base class types for your business objects when you switch the UI for
the object from Windows Forms to XAML – though I suspect other minor tweaks may be
necessary as well in some edge cases.
&lt;/p&gt;
&lt;p&gt;
But let’s face it, at some point CSLA .NET does have to drop legacy technologies.
I’m just one guy, and even with Magenic being such a great patron it isn’t realistic
to support every technology ever invented for .NET :)&amp;#160; I don’t think the time
to drop Windows Forms is in 4.0, because there are way too many people who need to
migrate to WPF over the next 2-3 years.
&lt;/p&gt;
&lt;p&gt;
On the other hand, if you and your organization aren’t developing a strategy to move
off Windows Forms in the next few years I suspect you’ll eventually wake up one day
and realize you are in a bad spot. One of those spots where you can’t hire anyone
because no one else has done your technology for years, and nobody really remembers
how it works (or at least won’t admit they do unless you offer them huge sums of money).
&lt;/p&gt;
&lt;p&gt;
I don’t see this as bad. People who want stability shouldn’t be in computing. They
should be in something like accounts receivable or accounts payable – parts of business
that haven’t changed substantially for decades, or perhaps centuries.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.lhotka.net/weblog/aggbug.ashx?id=89d338dc-9021-45b3-9c53-839762ea0b5d" /&gt;</description>
      <comments>http://www.lhotka.net/weblog/CommentView,guid,89d338dc-9021-45b3-9c53-839762ea0b5d.aspx</comments>
      <category>CSLA .NET</category>
      <category>Microsoft .NET</category>
      <category>Silverlight</category>
      <category>WCF</category>
      <category>Web</category>
      <category>Windows Forms</category>
      <category>WPF</category>
    </item>
    <item>
      <trackback:ping>http://www.lhotka.net/weblog/Trackback.aspx?guid=c76d5eb6-ad0e-48fb-abee-28e81736cdcf</trackback:ping>
      <pingback:server>http://www.lhotka.net/weblog/pingback.aspx</pingback:server>
      <pingback:target>http://www.lhotka.net/weblog/PermaLink,guid,c76d5eb6-ad0e-48fb-abee-28e81736cdcf.aspx</pingback:target>
      <dc:creator>Rockford Lhotka</dc:creator>
      <wfw:comment>http://www.lhotka.net/weblog/CommentView,guid,c76d5eb6-ad0e-48fb-abee-28e81736cdcf.aspx</wfw:comment>
      <wfw:commentRss>http://www.lhotka.net/weblog/SyndicationService.asmx/GetEntryCommentsRss?guid=c76d5eb6-ad0e-48fb-abee-28e81736cdcf</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
PDC 2008 was a lot of fun - a big show, with lots of announcements, lots of sessions
and some thought-provoking content. I thought I'd through out a few observations.
Not really conclusions, as those take time and reflection, so just some observations.
</p>
        <p>
          <strong>Windows Azure</strong>, the operating system for the cloud, is intriguing.
For a first run at this, the technology seems surprisingly complete and contains a
pretty reasonable set of features. I can easily see how web sites, XML services and
both data-centric and compute-centric processing could be built for this platform.
For that matter, it looks like it would be perhaps a week's work to get my web site
ported over to run completely in Azure.
</p>
        <p>
The real question is whether that would even make sense, and <em>that</em> comes down
to the value proposition. One big component of value is price. Like anyone else, I
pay a certain amount to run my web site. Electricity, bandwidth, support time, hardware
costs, software costs, etc. I've never really sorted out an exact cost, but it isn't
real high on a per-month basis. And I could host on any number of .NET-friendly hosting
services that have been around for years, and some of them are pretty inexpensive.
So the question becomes whether Azure will be priced in such a way that it is attractive
to me. If so, I'm excited about Azure!! If not, then I really don't care about Azure.
</p>
        <p>
I suspect most attendees went through a similar thought process. If Microsoft prices
Azure for "the enterprise" then 90% of the developers in the world simply don't care
about Azure. But if Microsoft prices Azure for small to mid-size businesses, and for
the very small players (like me) then 90% of the developers in the world should (I
think) really be looking at this technology
</p>
        <p>
          <strong>Windows 7 </strong>looks good to me. After the Tuesday keynote I was ready
to install it <em>now</em>. As time goes by the urgency has faded a bit - Vista has
stabilized nicely over the past 6-8 months and I really like it now. Windows 7 has
some nice-sounding new features though. Probably the single biggest one is reduced
system resource requirements. If Microsoft can deliver on that part of the promise
I'll be totally thrilled. Though I really <em>do</em> want multi-monitor RDP and the
ability to manage, mount (and even boot from) vhd files directly from the host OS.
</p>
        <p>
In talking to friends of mine that work at Microsoft, my level of confidence in W7
is quite high. A couple of them have been running it for some time now, and while
it is clearly pre-beta, they have found it to be a very satisfying experience. When
I get back from all my travels I do think I'll have to buy a spare HD for my laptop
and give it a try myself.
</p>
        <p>
The <strong>Oslo modeling tools</strong> are also interesting, though they are more
future-looking. Realistically this idea of model-driven development will require a
major shift in how our industry thinks about and approaches <a href="http://magenic.com/Services/CustomSoftwareDevelopment.aspx">custom
software development</a>. Such a massive shift will take many years to occur, regardless
of whether the technology is there to enable it. It is admirable that Microsoft is
taking such a gamble - building a set of tools and technologies for something that
might become acceptable to developers in the murky future. Their gamble will pay off
if we collectively decide that the world of 3GL development really is at an end and
that we need to move to higher levels of abstraction. Of course we could decide to
stick with what has (and hasn't) worked for 30+ years, in which case modeling tools
will go the way of CASE.
</p>
        <p>
But even if some of the really forward-looking modeling ideas never become palatable,
many of the things Microsoft is doing to support modeling are immediately useful.
Enhancements to Windows Workflow are a prime example, as is the M language. I've hard
a hard time getting excited about WF, because it has felt like a graphical way to
do FORTRAN. But some of the enhancements to WF directly address my primary concerns,
and I can see myself getting much more interested in WF in the relatively near future.
And the ability of the M language to define other languages (create DSLs), where I
can create my own output generator to create whatever I need - now <em>that</em> is
really, really cool!
</p>
        <p>
Once I get done with my book and all my fall travel, you can bet I'll be exploring
the use of M to create a specialized language to simplify the creation of CSLA .NET
business classes :)
</p>
        <p>
There were numerous talks about <strong>.NET 4.0</strong> and the future of C# and
VB. 
</p>
        <p>
Probably the single biggest thing on the language front is that Microsoft has finally
decided to sync VB and C# so they have feature parity. Enough of this back-and-forth
with different features, the languages will now just move forward together. A few
years ago I would have argued against this, because competition breeds innovation.
But today I don't think it matters, because the innovation is coming from F#, Ruby,
Python and various other languages and initiatives. Both VB and C# have such massive
pre-existing code-bases (all the code we've written) that they can't move rapidly
or explore radical ideas - while some of these other languages are more free to do
just that.
</p>
        <p>
The framework itself has all sorts of changes and improvements. I spent less time
looking at this than at Azure and Oslo though, so I honestly just don't have a lot
to say on it right now. I look at .NET 4.0 and Visual Studio 2010 as being more tactical
- things I'll spend a lot of time on over the next few months anyway - so I didn't
see so much need to spend my time on it during PDC.
</p>
        <p>
Finally, there were announcements around <strong>Silverlight and WPF</strong>. If
anyone doubts that XAML is the future of the UI on Windows and (to some degree) the
web, now is the time to wake up and smell the coffee. I'm obviously convinced Silverlight
is going to rapidly become the default technology for building business apps, with
WPF and Ajax as fallback positions, and everything at the PDC simply reinforced this
viewpoint.
</p>
        <p>
The new Silverlight and WPF toolkits provide better parity between the two XAML dialects,
and show how aggressively Microsoft is working to achieve true parity.
</p>
        <p>
But more important is the Silverlight intersection with Azure and Live Mesh. The fact
that I can build <em>smart client apps</em> that totally host in Azure or the Mesh
is compelling, and puts Silverlight a notch above WPF in terms of being the desired
start-point for app development. Yes, I really like WPF, but even if it can host in
Azure it probably won't host in Mesh, and in neither case will it be as clean or seamless.
</p>
        <p>
So while I fully appreciate that WPF is good for that small percentage of business
apps that need access to DirectX or rich client-side resources, I still think <em>most</em> business
apps will work just fine with access to the monitor/keyboard/mouse/memory/CPU provided
by Silverlight. 
</p>
        <p>
A couple people asked why I think Silverlight is better than Ajax. To me this is drop-dead
simple. I can write a class in C# or VB that runs on the client in Silverlight. I
can write real smart client applications that run in the browser. And I can run that <em>exact
same code</em> on the server too. So I can give the user a very interactive experience,
and then re-run that same code on the server because I don't trust the client.
</p>
        <p>
To do that in Ajax you'd either have to write your code twice (in C# and in Javascript),
or you'd have to do tons of server calls to simulate the interactivity provided by
Silverlight - and that obviously won't scale nearly the same as the more correct Silverlight
solution.
</p>
        <p>
To me it is a no-brainer - Ajax loses when it comes to building interactive business
apps like order entry screens, customer maintenance screens, etc.
</p>
        <p>
That's not to say Ajax has no home. The web and browser world is really good at displaying
data, and Ajax makes data display more interesting that simple HTML. I strongly suspect
that most "Silverlight" apps will make heavy use of HTML/Ajax for data display, but
I just can't see why anyone would willingly choose to create data entry forms or other
interactive parts of their app outside of Silverlight.
</p>
        <p>
And that wraps up my on-the-flight-home summary of thoughts about PDC. 
</p>
        <p>
Next week I'm speaking at the Patterns and Practices Summit in Redmond, and then I'll
be at Tech Ed EMEA in Barcelona. I'm doing a number of sessions at both events, but
what's cool is that at each event I'm doing a talk specifically about CSLA .NET for
Silverlight. And in December I'll be at VS Live in Dallas, where I'll also give a
talk directly on using CSLA .NET.
</p>
        <img width="0" height="0" src="http://www.lhotka.net/weblog/aggbug.ashx?id=c76d5eb6-ad0e-48fb-abee-28e81736cdcf" />
      </body>
      <title>Thoughts on PDC 2008</title>
      <guid isPermaLink="false">http://www.lhotka.net/weblog/PermaLink,guid,c76d5eb6-ad0e-48fb-abee-28e81736cdcf.aspx</guid>
      <link>http://www.lhotka.net/weblog/ThoughtsOnPDC2008.aspx</link>
      <pubDate>Sat, 01 Nov 2008 01:10:16 GMT</pubDate>
      <description>&lt;p&gt;
PDC 2008 was a lot of fun - a big show, with lots of announcements, lots of sessions
and some thought-provoking content. I thought I'd through out a few observations.
Not really conclusions, as those take time and reflection, so just some observations.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Windows Azure&lt;/strong&gt;, the operating system for the cloud, is intriguing.
For a first run at this, the technology seems surprisingly complete and contains a
pretty reasonable set of features. I can easily see how web sites, XML services and
both data-centric and compute-centric processing could be built for this platform.
For that matter, it looks like it would be perhaps a week's work to get my web site
ported over to run completely in Azure.
&lt;/p&gt;
&lt;p&gt;
The real question is whether that would even make sense, and &lt;em&gt;that&lt;/em&gt; comes down
to the value proposition. One big component of value is price. Like anyone else, I
pay a certain amount to run my web site. Electricity, bandwidth, support time, hardware
costs, software costs, etc. I've never really sorted out an exact cost, but it isn't
real high on a per-month basis. And I could host on any number of .NET-friendly hosting
services that have been around for years, and some of them are pretty inexpensive.
So the question becomes whether Azure will be priced in such a way that it is attractive
to me. If so, I'm excited about Azure!! If not, then I really don't care about Azure.
&lt;/p&gt;
&lt;p&gt;
I suspect most attendees went through a similar thought process. If Microsoft prices
Azure for "the enterprise" then 90% of the developers in the world simply don't care
about Azure. But if Microsoft prices Azure for small to mid-size businesses, and for
the very small players (like me) then 90% of the developers in the world should (I
think) really be looking at this technology
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Windows 7 &lt;/strong&gt;looks good to me. After the Tuesday keynote I was ready
to install it &lt;em&gt;now&lt;/em&gt;. As time goes by the urgency has faded a bit - Vista has
stabilized nicely over the past 6-8 months and I really like it now. Windows 7 has
some nice-sounding new features though. Probably the single biggest one is reduced
system resource requirements. If Microsoft can deliver on that part of the promise
I'll be totally thrilled. Though I really &lt;em&gt;do&lt;/em&gt; want multi-monitor RDP and the
ability to manage, mount (and even boot from) vhd files directly from the host OS.
&lt;/p&gt;
&lt;p&gt;
In talking to friends of mine that work at Microsoft, my level of confidence in W7
is quite high. A couple of them have been running it for some time now, and while
it is clearly pre-beta, they have found it to be a very satisfying experience. When
I get back from all my travels I do think I'll have to buy a spare HD for my laptop
and give it a try myself.
&lt;/p&gt;
&lt;p&gt;
The &lt;strong&gt;Oslo modeling tools&lt;/strong&gt; are also interesting, though they are more
future-looking. Realistically this idea of model-driven development will require a
major shift in how our industry thinks about and approaches &lt;a href="http://magenic.com/Services/CustomSoftwareDevelopment.aspx"&gt;custom
software development&lt;/a&gt;. Such a massive shift will take many years to occur, regardless
of whether the technology is there to enable it. It is admirable that Microsoft is
taking such a gamble - building a set of tools and technologies for something that
might become acceptable to developers in the murky future. Their gamble will pay off
if we collectively decide that the world of 3GL development really is at an end and
that we need to move to higher levels of abstraction. Of course we could decide to
stick with what has (and hasn't) worked for 30+ years, in which case modeling tools
will go the way of CASE.
&lt;/p&gt;
&lt;p&gt;
But even if some of the really forward-looking modeling ideas never become palatable,
many of the things Microsoft is doing to support modeling are immediately useful.
Enhancements to Windows Workflow are a prime example, as is the M language. I've hard
a hard time getting excited about WF, because it has felt like a graphical way to
do FORTRAN. But some of the enhancements to WF directly address my primary concerns,
and I can see myself getting much more interested in WF in the relatively near future.
And the ability of the M language to define other languages (create DSLs), where I
can create my own output generator to create whatever I need - now &lt;em&gt;that&lt;/em&gt; is
really, really cool!
&lt;/p&gt;
&lt;p&gt;
Once I get done with my book and all my fall travel, you can bet I'll be exploring
the use of M to create a specialized language to simplify the creation of CSLA .NET
business classes :)
&lt;/p&gt;
&lt;p&gt;
There were numerous talks about &lt;strong&gt;.NET 4.0&lt;/strong&gt; and the future of C# and
VB. 
&lt;/p&gt;
&lt;p&gt;
Probably the single biggest thing on the language front is that Microsoft has finally
decided to sync VB and C# so they have feature parity. Enough of this back-and-forth
with different features, the languages will now just move forward together. A few
years ago I would have argued against this, because competition breeds innovation.
But today I don't think it matters, because the innovation is coming from F#, Ruby,
Python and various other languages and initiatives. Both VB and C# have such massive
pre-existing code-bases (all the code we've written) that they can't move rapidly
or explore radical ideas - while some of these other languages are more free to do
just that.
&lt;/p&gt;
&lt;p&gt;
The framework itself has all sorts of changes and improvements. I spent less time
looking at this than at Azure and Oslo though, so I honestly just don't have a lot
to say on it right now. I look at .NET 4.0 and Visual Studio 2010 as being more tactical
- things I'll spend a lot of time on over the next few months anyway - so I didn't
see so much need to spend my time on it during PDC.
&lt;/p&gt;
&lt;p&gt;
Finally, there were announcements around &lt;strong&gt;Silverlight and WPF&lt;/strong&gt;. If
anyone doubts that XAML is the future of the UI on Windows and (to some degree) the
web, now is the time to wake up and smell the coffee. I'm obviously convinced Silverlight
is going to rapidly become the default technology for building business apps, with
WPF and Ajax as fallback positions, and everything at the PDC simply reinforced this
viewpoint.
&lt;/p&gt;
&lt;p&gt;
The new Silverlight and WPF toolkits provide better parity between the two XAML dialects,
and show how aggressively Microsoft is working to achieve true parity.
&lt;/p&gt;
&lt;p&gt;
But more important is the Silverlight intersection with Azure and Live Mesh. The fact
that I can build &lt;em&gt;smart client apps&lt;/em&gt; that totally host in Azure or the Mesh
is compelling, and puts Silverlight a notch above WPF in terms of being the desired
start-point for app development. Yes, I really like WPF, but even if it can host in
Azure it probably won't host in Mesh, and in neither case will it be as clean or seamless.
&lt;/p&gt;
&lt;p&gt;
So while I fully appreciate that WPF is good for that small percentage of business
apps that need access to DirectX or rich client-side resources, I still think &lt;em&gt;most&lt;/em&gt; business
apps will work just fine with access to the monitor/keyboard/mouse/memory/CPU provided
by Silverlight. 
&lt;/p&gt;
&lt;p&gt;
A couple people asked why I think Silverlight is better than Ajax. To me this is drop-dead
simple. I can write a class in C# or VB that runs on the client in Silverlight. I
can write real smart client applications that run in the browser. And I can run that &lt;em&gt;exact
same code&lt;/em&gt; on the server too. So I can give the user a very interactive experience,
and then re-run that same code on the server because I don't trust the client.
&lt;/p&gt;
&lt;p&gt;
To do that in Ajax you'd either have to write your code twice (in C# and in Javascript),
or you'd have to do tons of server calls to simulate the interactivity provided by
Silverlight - and that obviously won't scale nearly the same as the more correct Silverlight
solution.
&lt;/p&gt;
&lt;p&gt;
To me it is a no-brainer - Ajax loses when it comes to building interactive business
apps like order entry screens, customer maintenance screens, etc.
&lt;/p&gt;
&lt;p&gt;
That's not to say Ajax has no home. The web and browser world is really good at displaying
data, and Ajax makes data display more interesting that simple HTML. I strongly suspect
that most "Silverlight" apps will make heavy use of HTML/Ajax for data display, but
I just can't see why anyone would willingly choose to create data entry forms or other
interactive parts of their app outside of Silverlight.
&lt;/p&gt;
&lt;p&gt;
And that wraps up my on-the-flight-home summary of thoughts about PDC. 
&lt;/p&gt;
&lt;p&gt;
Next week I'm speaking at the Patterns and Practices Summit in Redmond, and then I'll
be at Tech Ed EMEA in Barcelona. I'm doing a number of sessions at both events, but
what's cool is that at each event I'm doing a talk specifically about CSLA .NET for
Silverlight. And in December I'll be at VS Live in Dallas, where I'll also give a
talk directly on using CSLA .NET.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.lhotka.net/weblog/aggbug.ashx?id=c76d5eb6-ad0e-48fb-abee-28e81736cdcf" /&gt;</description>
      <comments>http://www.lhotka.net/weblog/CommentView,guid,c76d5eb6-ad0e-48fb-abee-28e81736cdcf.aspx</comments>
      <category>Microsoft .NET</category>
      <category>Silverlight</category>
      <category>WCF</category>
      <category>Workflow</category>
      <category>WPF</category>
    </item>
    <item>
      <trackback:ping>http://www.lhotka.net/weblog/Trackback.aspx?guid=9d6642d3-d262-438f-9c31-8d38f5257ee4</trackback:ping>
      <pingback:server>http://www.lhotka.net/weblog/pingback.aspx</pingback:server>
      <pingback:target>http://www.lhotka.net/weblog/PermaLink,guid,9d6642d3-d262-438f-9c31-8d38f5257ee4.aspx</pingback:target>
      <dc:creator>Rockford Lhotka</dc:creator>
      <wfw:comment>http://www.lhotka.net/weblog/CommentView,guid,9d6642d3-d262-438f-9c31-8d38f5257ee4.aspx</wfw:comment>
      <wfw:commentRss>http://www.lhotka.net/weblog/SyndicationService.asmx/GetEntryCommentsRss?guid=9d6642d3-d262-438f-9c31-8d38f5257ee4</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
WCF is very cool, but configuring WCF can virtually derail a project. Even relatively
simple-seeming configurations can take hours or days to get working. It is frustrating!
And the most complex part is getting security working.
</p>
        <p>
The Microsoft Patterns and Practices group recently released beta guidance for
WCF security (<a href="http://www.codeplex.com/wcfsecurityguide">http://www.codeplex.com/wcfsecurityguide</a>),
and it is probably the single best resource for information about configuring WCF
security you'll find anywhere.
</p>
        <img width="0" height="0" src="http://www.lhotka.net/weblog/aggbug.ashx?id=9d6642d3-d262-438f-9c31-8d38f5257ee4" />
      </body>
      <title>WCF Security Guidance beta available</title>
      <guid isPermaLink="false">http://www.lhotka.net/weblog/PermaLink,guid,9d6642d3-d262-438f-9c31-8d38f5257ee4.aspx</guid>
      <link>http://www.lhotka.net/weblog/WCFSecurityGuidanceBetaAvailable.aspx</link>
      <pubDate>Thu, 12 Jun 2008 15:30:48 GMT</pubDate>
      <description>&lt;p&gt;
WCF is very cool, but configuring WCF can virtually derail a project. Even relatively
simple-seeming configurations can take hours or days to get working. It is frustrating!
And the most complex part is getting security working.
&lt;/p&gt;
&lt;p&gt;
The Microsoft Patterns and Practices group recently released beta guidance&amp;nbsp;for
WCF security (&lt;a href="http://www.codeplex.com/wcfsecurityguide"&gt;http://www.codeplex.com/wcfsecurityguide&lt;/a&gt;),
and it is probably the single best resource for information about configuring WCF
security you'll find anywhere.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.lhotka.net/weblog/aggbug.ashx?id=9d6642d3-d262-438f-9c31-8d38f5257ee4" /&gt;</description>
      <comments>http://www.lhotka.net/weblog/CommentView,guid,9d6642d3-d262-438f-9c31-8d38f5257ee4.aspx</comments>
      <category>WCF</category>
    </item>
    <item>
      <trackback:ping>http://www.lhotka.net/weblog/Trackback.aspx?guid=bcd4e249-8203-40e2-bced-2978423fd38b</trackback:ping>
      <pingback:server>http://www.lhotka.net/weblog/pingback.aspx</pingback:server>
      <pingback:target>http://www.lhotka.net/weblog/PermaLink,guid,bcd4e249-8203-40e2-bced-2978423fd38b.aspx</pingback:target>
      <dc:creator>Rockford Lhotka</dc:creator>
      <wfw:comment>http://www.lhotka.net/weblog/CommentView,guid,bcd4e249-8203-40e2-bced-2978423fd38b.aspx</wfw:comment>
      <wfw:commentRss>http://www.lhotka.net/weblog/SyndicationService.asmx/GetEntryCommentsRss?guid=bcd4e249-8203-40e2-bced-2978423fd38b</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <div style="FLOAT: right; MARGIN: 5px 15px 5px 5px">
          <a href="http://store.lhotka.net">
            <img src="http://www.lhotka.net/images/csla30cscover-165.jpg" border="0" />
          </a>
        </div>
        <p>
CSLA .NET version 3.0 adds support for Microsoft .NET 3.0 features. This ~120
page ebook covers how to use these new capabilities: 
</p>
        <p>
        </p>
        <ul>
          <li>
Windows Presentation Foundation (WPF) 
<ul><li>
Creating WPF forms using business objects 
</li><li>
Using the new controls in the Csla.Wpf namespace 
<ul><li>
CslaDataProvider 
</li><li>
Validator 
</li><li>
Authorizer 
</li><li>
ObjectStatus 
</li><li>
IdentityConverter</li></ul></li><li>
Maximizing XAML and minimizing C#/VB code</li></ul></li>
          <li>
Windows Communication Foundation (WCF) 
<ul><li>
Using the new WCF data portal channel to seamlessly upgrade from Remoting, Web services
or Enterprise Services 
</li><li>
Building WCF services using business objects 
</li><li>
Applying WCF security to encrypt data on the wire 
</li><li>
Sending username/password credentials to a WCF service 
<ul><li>
Including use of the new Csla.Security.PrincipalCache class</li></ul></li><li>
Using the DataContract attribute instead of the Serializable attribute</li></ul></li>
          <li>
Windows Workflow Foundation (WF) 
<ul><li>
Creating activities using business objects 
</li><li>
Invoking a workflow from a business object 
</li><li>
Using the WorkflowManager class in the Csla.Workflow namespace</li></ul></li>
        </ul>
        <p>
Version 3.0 is an <em>additive update</em>, meaning that you only need to use the
.NET 3.0 features if you are using .NET 3.0. CSLA .NET 3.0 <em>is useful <a href="http://www.lhotka.net/Article.aspx?area=4&amp;id=ac20fe4c-6afc-4176-bcb4-d74b5a370356">for
people using .NET 2.0</a>!!</em> These features include:
</p>
        <ul>
          <li>
Enhancements to the validation subsystem 
<ul><li>
Friendly names for properties 
</li><li>
Better null handling in the RegExMatch rule method 
</li><li>
New StringMinLength rule method 
</li><li>
Help for code generation through the DecoratedRuleArgs class</li></ul></li>
          <li>
Data binding issues 
<ul><li>
Fixed numerous bugs in BusinessListBase to improve data binding behavior 
</li><li>
Throw exception when edit levels get out of sync, making debugging easier 
</li><li>
N-level undo changed to provide parity with Windows Forms data binding requirements</li></ul></li>
          <li>
AutoCloneOnUpdate 
<ul><li>
Automatically clone objects when Save() is called, but only when data portal is local</li></ul></li>
          <li>
Enhancements to the authorization subsystem 
<ul><li>
CanExecuteMethod() allows authorization for arbitrary methods</li></ul></li>
        </ul>
        <p>
CSLA .NET 3.0 includes numerous bug fixes and some feature enhancements that benefit
everyone. If you are using version 2.0 or 2.1, you should consider upgrading to 3.0
to gain these benefits, even if you aren't using .NET 3.0.
</p>
        <p>
See the change logs for <a href="http://www.lhotka.net/Article.aspx?area=4&amp;id=0c94aa82-b975-455b-a0c5-f4f7196a2408">version
3.0</a>, <a href="http://www.lhotka.net/Article.aspx?area=4&amp;id=4534c39c-c5d8-4553-88af-bdc1c8149cbc">version
3.0.1</a> and <a href="http://www.lhotka.net/Article.aspx?area=4&amp;id=7360998d-d842-49f6-b1f0-a21b517798e3">version
3.0.2</a> for a more detailed list of changes.
</p>
        <p>
          <em>Using CSLA .NET 3.0</em> is completely focused on how to use the new features
in version 3.0. The book does not detail the internal changes to CSLA .NET itself,
so all ~120 pages help you use the enhancements added since version 2.1.
</p>
        <p>
          <font size="5">Get the book at </font>
          <a href="http://store.lhotka.net/">
            <font size="5">store.lhotka.net</font>
          </a>
          <font size="5">. 
<br />
(C# available now, VB available in early October)</font>
        </p>
        <p>
Download the 3.0.2 code from the <a href="http://www.lhotka.net/cslanet/download.aspx">CSLA
.NET download page</a>.
</p>
        <img width="0" height="0" src="http://www.lhotka.net/weblog/aggbug.ashx?id=bcd4e249-8203-40e2-bced-2978423fd38b" />
      </body>
      <title>Using CSLA .NET 3.0 ebook available (and CSLA .NET version 3.0.2)</title>
      <guid isPermaLink="false">http://www.lhotka.net/weblog/PermaLink,guid,bcd4e249-8203-40e2-bced-2978423fd38b.aspx</guid>
      <link>http://www.lhotka.net/weblog/UsingCSLANET30EbookAvailableAndCSLANETVersion302.aspx</link>
      <pubDate>Fri, 28 Sep 2007 21:21:26 GMT</pubDate>
      <description>&lt;div style="FLOAT: right; MARGIN: 5px 15px 5px 5px"&gt;&lt;a href="http://store.lhotka.net"&gt;&lt;img src="http://www.lhotka.net/images/csla30cscover-165.jpg" border=0&gt;&lt;/a&gt; 
&lt;/div&gt;
&lt;p&gt;
CSLA .NET version&amp;nbsp;3.0 adds support for Microsoft .NET 3.0 features. This ~120
page ebook covers how to use these new capabilities: 
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Windows Presentation Foundation (WPF) 
&lt;ul&gt;
&lt;li&gt;
Creating&amp;nbsp;WPF forms using business objects 
&lt;li&gt;
Using the new controls in the Csla.Wpf namespace 
&lt;ul&gt;
&lt;li&gt;
CslaDataProvider 
&lt;li&gt;
Validator 
&lt;li&gt;
Authorizer 
&lt;li&gt;
ObjectStatus 
&lt;li&gt;
IdentityConverter&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
Maximizing XAML and minimizing C#/VB code&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
Windows Communication Foundation (WCF) 
&lt;ul&gt;
&lt;li&gt;
Using the new WCF data portal channel to seamlessly upgrade from Remoting, Web services
or Enterprise Services 
&lt;li&gt;
Building WCF services using business objects 
&lt;li&gt;
Applying WCF security to encrypt data on the wire 
&lt;li&gt;
Sending username/password credentials to a WCF service 
&lt;ul&gt;
&lt;li&gt;
Including use of the new Csla.Security.PrincipalCache class&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
Using the DataContract attribute instead of the Serializable attribute&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
Windows Workflow Foundation (WF) 
&lt;ul&gt;
&lt;li&gt;
Creating activities using business objects 
&lt;li&gt;
Invoking a workflow from a business object 
&lt;li&gt;
Using the WorkflowManager class in the Csla.Workflow namespace&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Version 3.0 is an &lt;em&gt;additive update&lt;/em&gt;, meaning that you only need to use the
.NET 3.0 features if you are using .NET 3.0. CSLA .NET 3.0 &lt;em&gt;is useful &lt;a href="http://www.lhotka.net/Article.aspx?area=4&amp;amp;id=ac20fe4c-6afc-4176-bcb4-d74b5a370356"&gt;for
people using .NET 2.0&lt;/a&gt;!!&lt;/em&gt; These features include:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Enhancements to the validation subsystem 
&lt;ul&gt;
&lt;li&gt;
Friendly names for properties 
&lt;li&gt;
Better null handling in the RegExMatch rule method 
&lt;li&gt;
New StringMinLength rule method 
&lt;li&gt;
Help for code generation through the DecoratedRuleArgs class&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
Data binding issues 
&lt;ul&gt;
&lt;li&gt;
Fixed numerous bugs in BusinessListBase to improve data binding behavior 
&lt;li&gt;
Throw exception when edit levels get out of sync, making debugging easier 
&lt;li&gt;
N-level undo changed to provide parity with Windows Forms data binding requirements&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
AutoCloneOnUpdate 
&lt;ul&gt;
&lt;li&gt;
Automatically clone objects when Save() is called, but only when data portal is local&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
Enhancements to the authorization subsystem 
&lt;ul&gt;
&lt;li&gt;
CanExecuteMethod() allows authorization for arbitrary methods&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
CSLA .NET 3.0 includes numerous bug fixes and some feature enhancements that benefit
everyone. If you are using version 2.0 or 2.1, you should consider upgrading to 3.0
to gain these benefits, even if you aren't using .NET 3.0.
&lt;/p&gt;
&lt;p&gt;
See the change logs for &lt;a href="http://www.lhotka.net/Article.aspx?area=4&amp;amp;id=0c94aa82-b975-455b-a0c5-f4f7196a2408"&gt;version
3.0&lt;/a&gt;, &lt;a href="http://www.lhotka.net/Article.aspx?area=4&amp;amp;id=4534c39c-c5d8-4553-88af-bdc1c8149cbc"&gt;version
3.0.1&lt;/a&gt; and &lt;a href="http://www.lhotka.net/Article.aspx?area=4&amp;amp;id=7360998d-d842-49f6-b1f0-a21b517798e3"&gt;version
3.0.2&lt;/a&gt; for a more detailed list of changes.
&lt;/p&gt;
&lt;p&gt;
&lt;em&gt;Using CSLA .NET 3.0&lt;/em&gt; is completely focused on how to use the new features
in version 3.0. The book does not detail the internal changes to CSLA .NET itself,
so all ~120 pages help you use the enhancements added since version 2.1.
&lt;/p&gt;
&lt;p&gt;
&lt;font size=5&gt;Get the book at &lt;/font&gt;&lt;a href="http://store.lhotka.net/"&gt;&lt;font size=5&gt;store.lhotka.net&lt;/font&gt;&lt;/a&gt;&lt;font size=5&gt;. 
&lt;br&gt;
(C# available now, VB available in early October)&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
Download the 3.0.2 code from the &lt;a href="http://www.lhotka.net/cslanet/download.aspx"&gt;CSLA
.NET download page&lt;/a&gt;.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.lhotka.net/weblog/aggbug.ashx?id=bcd4e249-8203-40e2-bced-2978423fd38b" /&gt;</description>
      <comments>http://www.lhotka.net/weblog/CommentView,guid,bcd4e249-8203-40e2-bced-2978423fd38b.aspx</comments>
      <category>Books</category>
      <category>CSLA .NET</category>
      <category>WCF</category>
      <category>Workflow</category>
      <category>WPF</category>
    </item>
    <item>
      <trackback:ping>http://www.lhotka.net/weblog/Trackback.aspx?guid=ab819402-7b21-4b8f-a72f-6ee173b09c22</trackback:ping>
      <pingback:server>http://www.lhotka.net/weblog/pingback.aspx</pingback:server>
      <pingback:target>http://www.lhotka.net/weblog/PermaLink,guid,ab819402-7b21-4b8f-a72f-6ee173b09c22.aspx</pingback:target>
      <dc:creator>Rockford Lhotka</dc:creator>
      <wfw:comment>http://www.lhotka.net/weblog/CommentView,guid,ab819402-7b21-4b8f-a72f-6ee173b09c22.aspx</wfw:comment>
      <wfw:commentRss>http://www.lhotka.net/weblog/SyndicationService.asmx/GetEntryCommentsRss?guid=ab819402-7b21-4b8f-a72f-6ee173b09c22</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I just spent the past few days pulling my hair out trying to get a custom principal
to work in WCF.
</p>
        <p>
Google returned all sorts of interesting, but often outdated and/or overly complex
results. I kept looking at the techniques people were using, thinking <em>this can't
be so hard!!!</em></p>
        <p>
Well, it turns out that it isn't that hard, but it is <em>terribly</em> obscure...
Fortunately I was able to get help from various people, including Clemens Vasters,
Juval Lowy and (in this case most importantly) Christian Weyer. Even these noted
WCF experts provided an array of options rather than a unified, simple answer like
I'd expected.
</p>
        <p>
My conclusion: while WCF really is cool as can be, it is also a deep plumbing technology
that begs for abstraction for use by "normal" people.
</p>
        <p>
Anyway, as a result of my queries, Christian got one of his colleagues to write the
blog post I <em>wish</em> I had found a few days ago: <a href="http://www.leastprivilege.com - Custom Principals and WCF">www.leastprivilege.com
- Custom Principals and WCF</a>.
</p>
        <p>
One of my motivations in researching this issue was for the WCF chapter in my upcoming <em>Using
CSLA .NET 3.0</em> ebook. There's now a comprehensive discussion of the topic in that
chapter, starting with the creation and use of X.509 certificates and walking through
the whole process of implementing custom authentication and using a custom principal
in a WCF service. Dominick's blog post is great, but only covers about a third of
the overall solution in the end.
</p>
        <p>
The ebook should be out toward the end of September, for those who are wondering.
</p>
        <img width="0" height="0" src="http://www.lhotka.net/weblog/aggbug.ashx?id=ab819402-7b21-4b8f-a72f-6ee173b09c22" />
      </body>
      <title>Custom Principals and WCF</title>
      <guid isPermaLink="false">http://www.lhotka.net/weblog/PermaLink,guid,ab819402-7b21-4b8f-a72f-6ee173b09c22.aspx</guid>
      <link>http://www.lhotka.net/weblog/CustomPrincipalsAndWCF.aspx</link>
      <pubDate>Thu, 09 Aug 2007 20:28:24 GMT</pubDate>
      <description>&lt;p&gt;
I just spent the past few days pulling my hair out trying to&amp;nbsp;get a custom principal
to work in WCF.
&lt;/p&gt;
&lt;p&gt;
Google returned all sorts of interesting, but often outdated and/or overly complex
results. I kept looking at the techniques people were using, thinking &lt;em&gt;this can't
be so hard!!!&lt;/em&gt;
&lt;/p&gt;
&lt;p&gt;
Well, it turns out that it isn't that hard, but it is &lt;em&gt;terribly&lt;/em&gt; obscure...
Fortunately I was able to get help from various people, including Clemens Vasters,
Juval Lowy and (in this case most importantly) Christian Weyer.&amp;nbsp;Even these noted
WCF experts provided an array of options rather than a unified, simple answer like
I'd expected.
&lt;/p&gt;
&lt;p&gt;
My conclusion: while WCF really is cool as can be, it is also a deep plumbing technology
that begs for abstraction for use by "normal" people.
&lt;/p&gt;
&lt;p&gt;
Anyway, as a result of my queries, Christian got one of his colleagues to write the
blog post I &lt;em&gt;wish&lt;/em&gt; I had found a few days ago: &lt;a href="http://www.leastprivilege.com - Custom Principals and WCF"&gt;www.leastprivilege.com
- Custom Principals and WCF&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
One of my motivations in researching this issue was for the WCF chapter in my upcoming &lt;em&gt;Using
CSLA .NET 3.0&lt;/em&gt; ebook. There's now a comprehensive discussion of the topic in that
chapter, starting with the creation and use of X.509 certificates and walking through
the whole process of implementing custom authentication and using a custom principal
in a WCF service. Dominick's blog post is great, but only covers about a third of
the overall solution in the end.
&lt;/p&gt;
&lt;p&gt;
The ebook should be out toward the end of September, for those who are wondering.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.lhotka.net/weblog/aggbug.ashx?id=ab819402-7b21-4b8f-a72f-6ee173b09c22" /&gt;</description>
      <comments>http://www.lhotka.net/weblog/CommentView,guid,ab819402-7b21-4b8f-a72f-6ee173b09c22.aspx</comments>
      <category>CSLA .NET</category>
      <category>WCF</category>
    </item>
    <item>
      <trackback:ping>http://www.lhotka.net/weblog/Trackback.aspx?guid=1b2ac299-bbfb-488f-a58d-70aa583bd115</trackback:ping>
      <pingback:server>http://www.lhotka.net/weblog/pingback.aspx</pingback:server>
      <pingback:target>http://www.lhotka.net/weblog/PermaLink,guid,1b2ac299-bbfb-488f-a58d-70aa583bd115.aspx</pingback:target>
      <dc:creator>Rockford Lhotka</dc:creator>
      <wfw:comment>http://www.lhotka.net/weblog/CommentView,guid,1b2ac299-bbfb-488f-a58d-70aa583bd115.aspx</wfw:comment>
      <wfw:commentRss>http://www.lhotka.net/weblog/SyndicationService.asmx/GetEntryCommentsRss?guid=1b2ac299-bbfb-488f-a58d-70aa583bd115</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I <a href="http://www.lhotka.net/weblog/WCFNetDataContractSerializerAndSecurityException.aspx">posted
previously </a>about an issue where the WCF NetDataContractSerializer was unable to
serialize a SecurityException object. Microsoft provided some insight.
</p>
        <p>
It turns out that the constructor of the SerializationException object doesn't set
the Action property to anything valid. Before you can serialize a SerializationException
with NDCS you must explicitly set the Action property to a valid SecurityAction.
</p>
        <p>
This <em>does mean</em> that NDCS is not compatible with the BinaryFormatter in this
case, but at least there's a workaround/solution.
</p>
        <p>
I've now updated CSLA .NET 3.0 to explicitly set the Action property any time a SecurityException
is thrown, thus allowing the WCF data portal channel to return valid details about
the nature of any exception.
</p>
        <img width="0" height="0" src="http://www.lhotka.net/weblog/aggbug.ashx?id=1b2ac299-bbfb-488f-a58d-70aa583bd115" />
      </body>
      <title>Resolution to the NetDataContract/SerializationException issue</title>
      <guid isPermaLink="false">http://www.lhotka.net/weblog/PermaLink,guid,1b2ac299-bbfb-488f-a58d-70aa583bd115.aspx</guid>
      <link>http://www.lhotka.net/weblog/ResolutionToTheNetDataContractSerializationExceptionIssue.aspx</link>
      <pubDate>Mon, 11 Jun 2007 15:07:53 GMT</pubDate>
      <description>&lt;p&gt;
I &lt;a href="http://www.lhotka.net/weblog/WCFNetDataContractSerializerAndSecurityException.aspx"&gt;posted
previously &lt;/a&gt;about an issue where the WCF NetDataContractSerializer was unable to
serialize a SecurityException object. Microsoft provided some insight.
&lt;/p&gt;
&lt;p&gt;
It turns out that the constructor of the SerializationException object doesn't set
the Action property to anything valid. Before you can serialize a SerializationException
with NDCS you must explicitly set the Action property to a valid SecurityAction.
&lt;/p&gt;
&lt;p&gt;
This &lt;em&gt;does mean&lt;/em&gt; that NDCS is not compatible with the BinaryFormatter in this
case, but at least there's a workaround/solution.
&lt;/p&gt;
&lt;p&gt;
I've now updated CSLA .NET 3.0 to explicitly set the Action property any time a SecurityException
is thrown, thus allowing the WCF data portal channel to return valid details about
the nature of any exception.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.lhotka.net/weblog/aggbug.ashx?id=1b2ac299-bbfb-488f-a58d-70aa583bd115" /&gt;</description>
      <comments>http://www.lhotka.net/weblog/CommentView,guid,1b2ac299-bbfb-488f-a58d-70aa583bd115.aspx</comments>
      <category>CSLA .NET</category>
      <category>Microsoft .NET</category>
      <category>WCF</category>
    </item>
    <item>
      <trackback:ping>http://www.lhotka.net/weblog/Trackback.aspx?guid=180a1aff-fb67-4555-9c80-ee1f0844309b</trackback:ping>
      <pingback:server>http://www.lhotka.net/weblog/pingback.aspx</pingback:server>
      <pingback:target>http://www.lhotka.net/weblog/PermaLink,guid,180a1aff-fb67-4555-9c80-ee1f0844309b.aspx</pingback:target>
      <dc:creator>Rockford Lhotka</dc:creator>
      <wfw:comment>http://www.lhotka.net/weblog/CommentView,guid,180a1aff-fb67-4555-9c80-ee1f0844309b.aspx</wfw:comment>
      <wfw:commentRss>http://www.lhotka.net/weblog/SyndicationService.asmx/GetEntryCommentsRss?guid=180a1aff-fb67-4555-9c80-ee1f0844309b</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
The WCF NetDataContractSerializer is an almost, but not quite perfect, replacement
for the BinaryFormatter. 
</p>
        <p>
The NDCS is very important, because without it WCF could never be viewed as a logical
upgrade path for either Remoting or Enterprise Services users. Both Remoting and Enterprise
Services use the BinaryFormatter to serialize objects and data for movement across
AppDomain, process or network boundaries.
</p>
        <p>
Very clearly, since WCF is the upgrade path for these core technologies, it had to
include a serialization technology that was functionally equivalent to the BinaryFormatter,
and that is the NDCS. The NDCS is very cool, because it honors both the Serializable
model and the DataContract model, and even allows you to mix them within a single
object graph.
</p>
        <p>
Unfortunately I have run into a serious issue, where the NDCS is not able to serialize
the System.Security.SecurityException type, while the BinaryFormatter has no issue
with it.
</p>
        <p>
The issue shows up in CSLA in the data portal, because it is quite possible for the
server to throw a SecurityException. You'd like to get that detail back on the client
so you can tell the user why the server call failed, but instead you get a "connection
unexpectedly closed" exception instead. The reason is that WCF itself blew up when
trying to serialize the SecurityException to return it to the client. So rather than
getting any meaningful result, the client gets this vague and nearly useless exception
instead.
</p>
        <p>
By the way, if you want to see the failure, just run this code:
</p>
        <p>
    Dim buffer As New System.IO.MemoryStream<br />
    Dim formatter As New System.Runtime.Serialization.NetDataContractSerializer<br />
    Dim ex As New System.Security.SecurityException("a test")<br />
    formatter.Serialize(buffer, ex)
</p>
        <p>
And if you want to see it not fail run this code:
</p>
        <p>
    Dim buffer As New System.IO.MemoryStream<br />
    Dim formatter As New System.Runtime.Serialization.Formatters.Binary.BinaryFormatter<br />
    Dim ex As New System.Security.SecurityException("a test")<br />
    formatter.Serialize(buffer, ex)
</p>
        <p>
I've been doing a lot of work with the NDCS over the past several months. And this
is the first time I've encountered a single case where NDCS didn't mirror the behavior
of the BinaryFormatter - which is why I do think this is a WCF bug. Now just to get
it acknowledged by someone at Microsoft so it can hopefully get fixed in the future...
</p>
        <p>
The immediate issue I face is that I'm not entirely sure how to resolve this issue
in the data portal. One (somewhat ugly) solution is to catch all exceptions (which
I actually do anyway), and then scan the object graph that is about to be returned
to the client to see if there's a SecurityException in the graph. If so perhaps I
could manually invoke the BinaryFormatter and just return a byte array. The problem
with that is in the case where the object graph is a mix of Serializable and DataContract
objects - in which case the BinaryFormatter won't work because it doesn't understand
DataContract...
</p>
        <p>
In the end I may just have to leave it be, and people will need to be aware that they
can never throw a SecurityException from the server...
</p>
        <img width="0" height="0" src="http://www.lhotka.net/weblog/aggbug.ashx?id=180a1aff-fb67-4555-9c80-ee1f0844309b" />
      </body>
      <title>WCF NetDataContractSerializer and SecurityException</title>
      <guid isPermaLink="false">http://www.lhotka.net/weblog/PermaLink,guid,180a1aff-fb67-4555-9c80-ee1f0844309b.aspx</guid>
      <link>http://www.lhotka.net/weblog/WCFNetDataContractSerializerAndSecurityException.aspx</link>
      <pubDate>Fri, 01 Jun 2007 17:34:14 GMT</pubDate>
      <description>&lt;p&gt;
The WCF NetDataContractSerializer is an almost, but not quite perfect, replacement
for the BinaryFormatter. 
&lt;/p&gt;
&lt;p&gt;
The NDCS is very important, because without it WCF could never be viewed as a logical
upgrade path for either Remoting or Enterprise Services users. Both Remoting and Enterprise
Services use the BinaryFormatter to serialize objects and data for movement across
AppDomain, process or network boundaries.
&lt;/p&gt;
&lt;p&gt;
Very clearly, since WCF is the upgrade path for these core technologies, it had to
include a serialization technology that was functionally equivalent to the BinaryFormatter,
and that is the NDCS. The NDCS is very cool, because it honors both the Serializable
model and the DataContract model, and even allows you to mix them within a single
object graph.
&lt;/p&gt;
&lt;p&gt;
Unfortunately I have run into a serious issue, where the NDCS is not able to serialize
the System.Security.SecurityException type, while the BinaryFormatter has no issue
with it.
&lt;/p&gt;
&lt;p&gt;
The issue shows up in CSLA in the data portal, because it is quite possible for the
server to throw a SecurityException. You'd like to get that detail back on the client
so you can tell the user why the server call failed, but instead you get a "connection
unexpectedly closed" exception instead. The reason is that WCF itself blew up when
trying to serialize the SecurityException to return it to the client. So rather than
getting any meaningful result, the client gets this vague and nearly useless exception
instead.
&lt;/p&gt;
&lt;p&gt;
By the way, if you want to see the failure, just run this code:
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim buffer As New System.IO.MemoryStream&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim formatter As New System.Runtime.Serialization.NetDataContractSerializer&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim ex As New System.Security.SecurityException("a test")&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; formatter.Serialize(buffer, ex)
&lt;/p&gt;
&lt;p&gt;
And if you want to see it not fail run this code:
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim buffer As New System.IO.MemoryStream&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim formatter As New System.Runtime.Serialization.Formatters.Binary.BinaryFormatter&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim ex As New System.Security.SecurityException("a test")&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; formatter.Serialize(buffer, ex)
&lt;/p&gt;
&lt;p&gt;
I've been doing a lot of work with the NDCS over the past several months. And this
is the first time I've encountered a single case where NDCS didn't mirror the behavior
of the BinaryFormatter - which is why I do think this is a WCF bug. Now just to get
it acknowledged by someone at Microsoft so it can hopefully get fixed in the future...
&lt;/p&gt;
&lt;p&gt;
The immediate issue I face is that I'm not entirely sure how to resolve this issue
in the data portal. One (somewhat ugly) solution is to catch all exceptions (which
I actually do anyway), and then scan the object graph that is about to be returned
to the client to see if there's a SecurityException in the graph. If so perhaps I
could manually invoke the BinaryFormatter and just return a byte array. The problem
with that is in the case where the object graph is a mix of Serializable and DataContract
objects - in which case the BinaryFormatter won't work because it doesn't understand
DataContract...
&lt;/p&gt;
&lt;p&gt;
In the end I may just have to leave it be, and people will need to be aware that they
can never throw a SecurityException from the server...
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.lhotka.net/weblog/aggbug.ashx?id=180a1aff-fb67-4555-9c80-ee1f0844309b" /&gt;</description>
      <comments>http://www.lhotka.net/weblog/CommentView,guid,180a1aff-fb67-4555-9c80-ee1f0844309b.aspx</comments>
      <category>CSLA .NET</category>
      <category>Microsoft .NET</category>
      <category>Service-Oriented</category>
      <category>WCF</category>
    </item>
  </channel>
</rss>