Subscribe: Jason Clark's Blog
Added By: Feedage Forager Feedage Grade B rated
Language: English
application  css  file  firefox  flex  forms  net  rank  service  set  system windows  system  web  windows forms  windows 
Rate this Feed
Rate this feedRate this feedRate this feedRate this feedRate this feed
Rate this feed 1 starRate this feed 2 starRate this feed 3 starRate this feed 4 starRate this feed 5 star

Comments (0)

Feed Details and Statistics Feed Statistics
Preview: Jason Clark's Blog

Jason Clark's Blog

Software, Hardware, whatever...


WCF Streaming Issue Under IIS

Thu, 14 Feb 2008 14:22:00 GMT

Recently, I've been doing a lot of work with streaming under an IIS hosted WCF service (using the BasicHttpBinding).   I ran into a rather strange issue, that appears to be an oversight deep inside the internals of WCF.   Enabling streaming on a binding is typically set when you anticipate sending large objects across the wire, and do not want to buffer up the entire message prior to sending.  When streaming mode is enabled, the headers of the message are buffered and the body is exposed as a stream and sent across the wire.   When you host your service inside a console app or windows service, everything works as expected (the body is indeed streamed no buffering at all).    Now comes the issue...

When you host your service under IIS, no matter if you enable streaming or not, your service will buffer the entire message prior to sending it.   The reason for this, is that it appears as though WCF does not set the Response.BufferOutput to "false" (default is true), when streaming is enabled on a service.   This seems to be an oversight in my opinion, that could be rectified in the framework code.   So the good news is, there is a way around this issue:

Since we want to somehow set that Response.BufferOutput to false, we need to get at the HttpContext.  The flexibility of WCF comes to our aid here with the ability to enable AspNet Compatibility Mode, there are 3 changes we need to make to the service, to work around this issue.  

1)  Add the following attribute to your service: [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]

2)  Inside the default constructor for your service, or wherever you want to set the bufferoutput property paste this code:

HttpContext httpContext = HttpContext.Current;

if (httpContext != null)
 httpContext.Response.BufferOutput = false;

3)  Inside place the following tag


What we've done here is get access to the HttpContext and manually set the flag, which isn't wonderful, but works around the problem.

A lesson learned about concurrent calls and WCF binding config.

Thu, 21 Jun 2007 23:19:00 GMT

I learned yet another binding configuration attribute today, that plays a rather important role if you have a service that could accept a large amount of concurrent calls.  By concurrent, I mean dozens of calls that come in at the same time.   Of course the standard throttles in this scenario are important, maxConnections on the binding and the various service model throttles (maxConcurrentCalls,maxConcurrentSessions,maxConcurrentInstances).  There is however one attribute that you may not be aware of, that if not set correctly will cause your clients to throw a rather nondescript exception like:

"The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '00:00:59.4383964'."

After spending the better part of a day, changing settings and staring at trace logs, I posted in the MSDN forums an example application demonstrating this behavior.  In the end, the solution to the exception was setting the listenBacklog attribute on the binding.  What does it do?  (from MSDN) "ListenBacklog is a socket-level property that describes the number of "pending accept" requests to be queued. Ensure that the underlying socket queue is not exceeded by the maximum number of concurrent connections."  So, ensure that you have this set higher or equal to the amount of maxConcurrentCalls.

Hope that helps someone else staring at a trace log, that doesn't indicate there are any problems with the service config.   Hopefully at some point a more descriptive exception is thrown when you hit this binding throttle.


Wierd windows forms ListView Issue, bug in .NET?

Tue, 02 May 2006 22:24:00 GMT

While working on a decent sized Windows Forms app in c#, I've seen a sporadic issue crop up that is incredibly difficult to debug.   The form simply has a listview on it that is populated from a worker thread.   The calls are all done with Invoke, on the UI thread.   But, every once and awhile (it's sporadic). .NET throws this:

Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
   at System.Windows.Forms.ListViewItemCollection.get_Item(Int32 displayIndex)
  at System.Windows.Forms.ListView.OnHandleDestroyed(EventArgs e)
   at System.Windows.Forms.Control.WmDestroy(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ListView.WndProc(Message& m)
   at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.ComponentManager.System.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.RunDialog(Form form)
   at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
   at System.Windows.Forms.Form.ShowDialog()

I can't find out where this is coming from, it has no reference to anything in the app, it's all in the framework. 

Anyone seen this?

File or assembly name not found follow up.

Thu, 18 Aug 2005 18:01:00 GMT

So, we finally figured out a problem a customer had with Microsoft's help.  As posted below the customer had random errors where a temp file that was generated by .NET (confirmed by Microsoft).   We ended up using filemon to log disk access while the error occurred, and the culprit was FreeTextBox.   We don't use FreeTextBox (although it is a great editor), but somehow it was in the bin directory on the clients server.   After we removed that dll the problem went away.   If we had been using it, the solution would have probably been to add it to the GAC.  If you ever run into this, use the method above as it's more than likely permissions and you'll know pretty quick whats going on with filemon from sysinternals.

File or assembly name or one of its dependencies not found?

Thu, 21 Jul 2005 14:15:00 GMT

We've recently had a customer contact us about an obscure error having to do with a dependency/assembly not found.   It looks like it's a temp file produced by .NET during compilation and is for some reason not found afterwards or during.   I've dug around and found that there are a couple of solutions to this issue, neither of which worked for the client. One was to disable indexing services so that no read locks would be performed on the temp dir that the .net framework uses, and the other was to register the DLL's into the GAC.   Problem is that the DLL or assembly its talking about doesn't exist in the applicaiton it's a temp file.  Error is below, if anyone has any ideas I'm all ears.


File or assembly name nwyqbbug, or one of its dependencies, was not found.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.FileNotFoundException: File or assembly name nwyqbbug, or one of its dependencies, was not found.

Assembly Load Trace: The following information can be helpful to determine why the assembly 'nwyqbbug' could not be loaded.

=== Pre-bind state information ===
LOG: DisplayName = nwyqbbug, Version=, Culture=neutral, PublicKeyToken=null
LOG: Appbase = file:///D:/wwwroot/Forums/Web/Forum
LOG: Initial PrivatePath = bin
Calling assembly : omgp_cyn, Version=, Culture=neutral, PublicKeyToken=null.

LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Post-policy reference: nwyqbbug, Version=, Culture=neutral, PublicKeyToken=null
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/web_forum/235e9bde/1539afa3/nwyqbbug.DLL.
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/web_forum/235e9bde/1539afa3/nwyqbbug/nwyqbbug.DLL.


Scoble throws it right back at Joel.

Thu, 16 Jun 2005 13:56:00 GMT

Joel over at Joel on software threw out some interesting commentary about how life at FogBugz palace is, compared to the dismal rags over at Microsoft *laugh*.   Scoble responded today with a colorful synopsis of just how bad life is at Microsoft.  I don't know about Joel's developers, but I sit in front of a 22" Apple Cinema display and use a Dual 3.6 Xeon with 2GB of memory ,15K SCSI  and a Quadro 3400 FX at home.

On a side note, how does bug tracking software get titled as "painless project management"?  I've always wondered how you could classify a great bug tracking system as a project management system.  They may intertwine, but I don't see how you can micro-manage a project by bugs.  There is a lot more to the delivery software than stamping out bugs...

FireFox can also have bugs? Could it be that FireFox developers make mistakes too?

Tue, 10 May 2005 16:09:00 GMT

Ever since FireFox started to gain momentum you constantly hear "FireFox is much more secure than IE".  These opinions are usually shared by folks that have not grasped the concept of  software development and popularity.   Anything written by any human is apt to have bugs.  Do you really think that FireFox engineers are brighter than any other engineer out there?  Do you think that with the cash Microsoft has on hand that they can't afford quality engineers?  The fact is that bugs are a fact of life, humans make mistakes and a FireFox engineer is no different than any one else.  In fact, according to an article in Internet Week, there are a pair of critical issues in FireFox that required you to shut off Javascript to be safe, pretty nasty stuff.  Just goes to show you that with popularity, awareness is increased and bugs are found.

CSS Architecture - Standards?

Thu, 28 Apr 2005 14:49:00 GMT

I've been doing some research on CSS Architecture/Standards, and have come up rather dry.   After spending a few hours hammering google with various keywords etc I can't find a single entity publishing any guidelines/standards for CSS development.  What I mean by that is CSS architecture as it pertains to the UI development, not the standards of the specification.  For example, is it best to use ID declarations for objects, or classes, etc.   Has anyone seen anything or read anything that talks about UI architecture using CSS? 

Just finished up an article on AMD Dual Core Opteron.

Thu, 21 Apr 2005 18:45:00 GMT

It's been a ton of last minute benchmarking, but well worth it.  Dual Core is set to make huge tracks in the server market, with impressive scaling.   Uniprocessor server configurations might well rise and Dual processor database servers will essentially perform like a 4P system.  Intel is still setting their Dual Core launch for Q1 2006.  We had a chance in the review to benchmark Intels latest Quad Xeon servers based on their new E8500 chipset, the system we had required 208V, a bit unusual from our experience but apparently doable at most NOC's.  So, we had to wire a 240V circuit in the lab.   The article covers both desktop and server performance, workstation is on the way.  The server stuff is near the beginning and covers web & sql performance.



ASP.NET 2.0 Membership/Role Observations

Tue, 19 Apr 2005 20:04:00 GMT

After digging a bit deeper this week on the built-in Membership/Roles functionality, although it is quite extensive there seems to be a weakness in using it for a more robust security model.  Maybe I've missed something, but here goes:

Let's say in a sample application I have roles entitled Manager and Employee.   So, within my application I can now say if user is in role X show/do this.   Now, let's say you wanted to have attributes to the role "Manager".  The "Manager" role can do the following ficticous tasks: Create Users, Delete Users, Update Website, Add Document, essentially creating a group with various permissions.  

From what I see there is no more depth beyond the Role...

Want to use Mozilla/Firefox with the built-in Visual Studio webserver?

Tue, 19 Apr 2005 15:16:00 GMT

After installing Beta 2 yesterday,  I fired up our application and started working through some code.   After verifying some layout code in IE, I launched FireFox and pointed it at the URL to the built-in webserver within Visual Studio.  To my surprise, I was greeted with "HTTP Error 403 - Forbidden".  Ruh? 

Previous copies of Visual Studio didn't behave in this manner, so I dug a bit in the Website option within Visual Studio to find that Microsoft as now enabled NTLM authentication as a default for the built-in webserver.  Why? I'm developing on my local PC why would I want to lock my local webserver down by NTLM?  Granted, the option should be there, but disabled by default.   Anyway, for those wanting to disable this, just go under Website --> Start Options and uncheck NTLM Authentication

Adobe to buy Macromedia for 3.4B in stock.

Mon, 18 Apr 2005 13:25:00 GMT


It was fairly clear Macromedia was looking to be acquired, it was just a matter of time.  Adobe is a bit of a surprise, since the two companies have been at each others throats over the years.  Judging by the article, it is an acquisition for Flash, and maybe Flex.  Hard to say what the future of ColdFusion and some of their other products will be, but the article makes no mention of them.  Thoughts?

More information:


CSS, Still not there?

Wed, 30 Mar 2005 20:34:00 GMT

When CSS1 first reared it's ugly head in 1996, it was probably one of the most controversial changes in Web UI history.   Over the years, we've all come to appreciate to some extent, the intended purpose of CSS. In most cases it does as intended and does it well.  But, even after 9 years we're still up to our ears in browser incompatibilities, and until CSS 2 is fully adopted everywhere an un-intuitive way of creating tables in CSS.  We all know how well floating divs works in CSS 1 *cough*.  How can it take 9 years to replace (whatever you want to call it) a simple tag based language (HTML)? 

All to often I've ran into the "Purist" movement, and been given the proverbial speech "Don't use

, you can do the exact same thing in CSS".  Sure, after wasting half a week on ironing out browser incompatibilities and general CSS awkwardness you can do anything.  But what these purists tend to forget is the age-old acronym K.I.S.S (keep it simple stupid).  At the end of the day, it's about getting the job done on time and as "standards based" as reasonably possible.  It isn't about following every recommendation or guideline to the letter, it's not realistic and is not a cost effective way of doing development.  Read this fellas page for some more rants on CSS & Tables.

The future of Web UI
Delivering web based applications over the web is here to stay, and is going to continue to grow as traditionalists realize the benefits.  The delivery method is the biggest hurdle, and hopefully over the years it will improve.  Writing web software for several browsers is a chore, and there is no rhyme or reason for the issues web developers are faced with today.  We need a solid, well-thought out, intuitive way to build applications that is written once and runs on any Browser (if that it is continued to named as such).  Macromedia Flex, Open Laszlo and a few others are moves in the right direction, although they still rely on a plug-in and have some client performance related issues that need to improve.  Hopefully in 5-10 years, the Web based application industry has the delivery model it needs.

ASP.NET 2.0 Themes/Skins

Fri, 11 Mar 2005 15:56:00 GMT

I've been doing a fair bit of work with ASP.NET 2.0 Themes the past day or two, and I have to say I'm impressed with it.   If you haven't heard about ASP.NET themes yet, they are a nifty new feature in ASP.NET 2 that allows you to quickly create a Skin/Theme structure for your web interface.    You can skin the controls that ship with ASP.NET and your own custom controls.  Skins can programmatic-ally be set on an application and global level, which is great for an application where the user selects their theme.   We took a set of themes we had done for an application and dropped them into our ASP.NET theme folders and within about 10 minutues had it hooked into the application, very cool.

For a good starter tutorial on it check out this one written by Bill Evjen.

IE7 Wants.

Thu, 03 Mar 2005 16:16:00 GMT

Recently Microsoft announced IE7, rightfully so as FireFox is certainly gained a loyal following.  On AnandTech 38% of all browsers are Gecko based, while 36% are IE.   I'm still an IE user, have been since IE4.  FireFox is a decent browser, I just prefer IE for some unknown reason.   I've been doing a fair bit of JavaScript work lately, and admittedly I've been using FireFox to do all of my debugging.   FireFox has a wonderful JavaScript console built in, that details the location of the error, including file name for multiple JS files.  It is far and away better than the JS errors IE gives you, "there was an error on line 4 (usually the wrong line number)".   FireFox also does not spawn alerts on JS errors within a page by default, you have to use the Console to view those (the way it should be IMHO). 

 IE Team, if you are listening please put this functionality in IE, while you're at it give us tabbed browsing :)

To Flex or not to Flex.

Wed, 02 Mar 2005 21:58:00 GMT

Recently at FuseTalk, we did some research on building our presentation tier for an upcoming project in Macromedia Flex.   If you’re not aware, Macromedia Flex is a presentation server that serves up Rich interfaces that are generated by server side XML and compiled then presented in the Flash Player.   Macromedia Flex makes a bold statement that the future of Web UI development is Rich & Ubiquitous.   Having built many an interface using CSS/JS, the day where the developer can forget about the cross-browser issues that plague us all, will be well received.    One could say that Macromedia is taking a leap with Flex, is the world ready to develop interfaces in this way?   Well, the product is realistically targeted at enterprise developers, so no, it isn’t the answer to everyone’s dreams right now.  But, it does make a statement about their vision of the future of Web based applications.     We spent about a month with Flex, making mock-ups of various screens that the application had.   The user interfaces you can build are impressive, they look very “Mac’ish”, but can be fully customized via CSS to look however you want.  We figured that Flex would save about 2-3 months work on building a similar interface using straight ASP.NET/CSS interface.  Most of the UI components that Flex provides can be done using ASP.NET minus drag and drop, and some of the behaviors like minimizing panels etc.   Those we would have to write JS libraries for, and would probably not work on every single browser out there (although they would function on the major browsers we’d support).    So, the decision of whether to use Flex or not came down to a few things for us.  One was the IDE.  The strength of a language is tightly coupled with it’s IDE, if the IDE isn’t strong then the language suffers.  I’d say this was probably one of the biggest reasons we decided to stay with the “old school” way of doing things for now.   The IDE that is shipped with Macromedia Flex is called “Flex Builder”, it’s essentially a re-skinned Dreamweaver with some Flex specific widgets and a debugger.    The debugging is a bit on the weak side, sometimes it wouldn’t stop at breakpoints, it was slow and if you wrote your own controls the debugger wouldn’t see them.  Overall the IDE seemed like an afterthought, “heck we built a language, let’s patch up Dreamweaver and use that”.    An IDE architected and coupled with the language is a necessity, having been used to Visual Studio my expectations were high.   Besides the IDE issues, the $12K price tag per server and lack of native .NET support also played into our decision to stick with an ASP.NET interface for the time being.   Another factor was performance, particularly the Grid component.   If you moved the scroll bar on a grid up and down, you could watch your CPU usage spike at 30%+ depending on the machine.    Maybe Flash Player 8 will address some of these performance issues.   Overall, Flex is an excellent first attempt and shows a heck of a lot of promise.  [...]

What Visual Studio 2005 build are you using?

Wed, 02 Mar 2005 20:46:00 GMT

We're using .NET 2 for an upcoming project, and I've been playing with December CTP.  It's fairly stable minus a few IDE hangs and crashes.  I'm curious what some of you are using, Beta 1? November CTP?  According to MSDN, November CTP is the most current build of Studio and the Framework.   I've noticed that in the December CTP, when you use the ASP.NET Web Configuration, that the Add Custom Provider option is not available.

Any feedback is welcome.

Producing a FullText search query that accounts for RANK and the freshness of content.

Tue, 01 Mar 2005 14:55:00 GMT

Recently at AnandTech, we decided to rewrite our search mechanisms to take date into account, while performing Full Text queries against Microsoft SQL Server's full text functionality.   By default, when you use CONTAINSTABLE, the search service will return a set of results with a RANK value associated with each row.  The RANK value is based on occurrence, proximity etc.  The problem comes when you order by the RANK value, and have time sensitive content.   What we've been toying with is combining RANK with the Date of the content.  The reason for this is to try and give the user results that are not only relevant but are also "fresh".   We went about this by writing a CASE statement into our query which essentially produces a weight value based on how old it is.  In the example query below, you can see how this works.   Based on how many weeks old the content is, we assign it a weight and that is combined with the RANK value that the search service returns.   Obviously we're still fairly RANK heavy, but date is taken into account.  You can adjust how RANK/Date heavy you want the results to be by changing how much you divide each RANK by at the end of each WHEN clause. 

Let me know if you've done something similar, or any thoughts on this technique.

SELECT DISTINCT TOP 21 d.idocumentid,d.vchdocumenttitle, d.dtinsertdate,
 WHEN datediff(wk, d.dtinsertdate, getdate()) between  0 and 4  THEN (allpages.rank/1.0)
 WHEN datediff(wk, d.dtinsertdate, getdate()) between  5 and 8  THEN (allpages.rank/1.2)
 WHEN datediff(wk, d.dtinsertdate, getdate()) between  9 and 12 THEN (allpages.rank/1.4)
 WHEN datediff(wk, d.dtinsertdate, getdate()) between 13 and 16 THEN (allpages.rank/1.6)
 WHEN datediff(wk, d.dtinsertdate, getdate()) between 17 and 20 THEN (allpages.rank/1.8)
 WHEN datediff(wk, d.dtinsertdate, getdate()) between 21 and 24 THEN (allpages.rank/2.0)
END AS WeightedRank
FROM documents d WITH (NOLOCK)
JOIN documentpages p WITH (NOLOCK) on d.idocumentid = p.idocumentid
JOIN CONTAINSTABLE(documentpages,txpage,' "intel" AND "centrino"',2000) allpages
ON p.irowid = allpages.[Key]
GROUP BY d.idocumentid, d.vchdocumenttitle, d.dtinsertdate,allpages.rank
ORDER BY WeightedRank DESC, d.dtinsertdate DESC



Who am I?

Thu, 24 Feb 2005 16:43:00 GMT

Welcome to my Blog space, yes yet another one :).   My name is Jason Clark, I'm a software developer with about 12 years of experience.    I currently the CTO over at FuseTalk (a collaboration software company, and in my spare time I also am the network/software engineer over at AnandTech (an on-line computer hardware/news site).   I've been working with .NET for approximately 2 years now, with many more ahead as both organizations I work with have standardized on the platform. 

For now it's back to the grind, more to follow.