Thursday, October 15, 2015

GridView Custom Paging without a DataSource

I don't think I am always happy about being on the bleeding edge.  Since we adopted asp.net before it was *really* ready for prime time we ended up developing custom methods for many things, the data layer being one of them.

So, how we have a custom way of getting data, that is NOT a datasource.  How can we do custom paging?

Finally, in Asp.Net 4.5 we have a way.  Check it out!


Thursday, May 21, 2015

Tuesday, April 21, 2015

Getting a breakpoint in Global.asax to be hit

When using IIS for debugging, not Visual Studio Development Server.

In this case, debugging application start is tricky, because it is only called once when the application pool is started or recycled. When Visual Studio attaches to the process, Application_Start has already been running.
The trick is to make the application pool recycle without killing the process you are attached to.
Do the following:
  1. In Visual Studio (must be run as Administrator) set your breakpoint in global.asax.cs and start debugging as usual (F5). The page opens in your web browser, but the breakpoint isn't hit.
  2. Now the trick: In Visual Studio, go to web.config, change it (e.g. enter a blank line somewhere) and save it. In contrast to recycling the application pool in IIS, this lets the application pool recycle (and thus running through Application_Start in global.asax.cs the next time the web site is called) without killing the process you are attached to.
  3. In your web browser, reload the page. The breakpoint should be hit now!
That works for me (IIS 7.5, VS2010) and (IIS 8.5, VS2013)

Monday, March 16, 2015

Stored Procedure in batch running slow? Stored Procedure fast in SSMS?

ArithAbort is your man!

If ARITHABORT is not set to on, we sometimes get performance problems with connections from the website (because UDL connections (really OLEDB) have ARITHABORT set to off).   When this setting is off, I suspect that the optimizer decides to do serial scans in the selects of the nested functions instead of indexed (or more optimal) reads.
We are OK with ARITHABORT set to on because the math involved should NOT cause an arithmetic exception.  And, even if it did, we want to fix it.

BTW the default for ARITHABORT in SSMS is on.  That is why these queries are always faster when trying execute them in a query window.

To see more, http://sqladvice.com/blogs/gstark/archive/2008/02/12/Arithabort-Option-Effects-Stored-Procedure-Performance.aspx

Monday, March 2, 2015

Win8 Finding the user (or windows feature) IIS AppPool

When adding the user type in the whole name
IIS AppPool\DefaultAppPool

Thursday, March 27, 2014

Fiddler and Asp.Net

Ran across this today, just a handy item to know.  I use Fiddler a lot of debugging web programming.  Today I needed to use to to debug some Web.Request conversation.  For the most part I write everything out to log files and it contains what I need.  But, I was dealing with a tech support organization who really wanted Fiddler output.


http://weblog.west-wind.com/posts/2009/Jan/14/Monitoring-HTTP-Output-with-Fiddler-in-NET-HTTP-Clients-and-WCF-Proxies

So, even though I have libraries to man-handle the Web.Requests the following entry in the web.config file allowed Fiddler to see the conversation.  No code change!

  <system.net>
    <defaultProxy>
      <proxy
              usesystemdefault="False"
              bypassonlocal="True" 
              proxyaddress="http://127.0.0.1:8888"              
              />
    </defaultProxy>
  </system.net>
 
If you forget and don't have Fiddler running, you can get the following error
System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:8888
 
 


Thursday, March 13, 2014

Handy App Pool info - 32bit vs 64 bit

We process a lot of huge document so to be able to run in 64 bit mode and use more than 4GB of memory is kind of important.

Trying to figure out which app pools are actually running in 32-bit mode

appcmd list wp

Then go into Task Manager, show processes for all users. If the PID doesn't show up then View | Select Columns | check PID

The processes that have a *32 next to the name are the ones running in 32 bit mode.

So, w3wp.exe *32 is running in 32 bit mode

How to solve that...

Go into the IIS Manager, find the Application Pools, right click | advanced settings | Enable 32-bit application = False.

You must compile your application in 64 bit mode or AnyCPU.  Here is a really good explanation for
moving-asp-net-web-application-from-32-bit-to-64-bit