SqlServerUploadStorageProvider won't trigger OnClick event handler

Jun 21, 2011 at 12:45 AM

Hi everyone,

I'm trying to stream my upload files directly into the database using SqlServerUploadStorageProvider, but I'm it does not behave correctly. Using SqlServerUploadStorageProvider works great on my local development PC.  However, once I deployed the solution onto the live system, I can see the progress bar moves when I performed the upload operation but then the uploaded file got removed.  I monitored the DB and see the file being pushed into the DB, however, the OnClick="UploadBtn_Clicked" event handler never got invoked.  Hence, the uploaded file got removed because verify() was only called inside UploadBtn_Clicked() method (which was never invoked).

I'm currently using NeatUpload 1.3.36 and have switched between 4.0 and 4.0 Integrated Pipeline.  Here is my web.config settings that I used:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <configSections>
      <section name="neatUpload" type="Brettle.Web.NeatUpload.ConfigSectionHandler, Brettle.Web.NeatUpload" allowLocation="true" />
    </configSections>
 
    <appSettings>
          <add key="StreamBufferSize" value="2097152" />
      </appSettings>
     
    <connectionStrings>   
       <add name="ArtistZone.Data" connectionString=...
    </connectionStrings>

    <system.web>
      <httpModules>
        <add name="UploadHttpModule" type="Brettle.Web.NeatUpload.UploadHttpModule, Brettle.Web.NeatUpload" />
      </httpModules>

      <fullTrustAssemblies>
        <add assemblyName="Brettle.Web.NeatUpload"
                 version="1.3.4034.20191"
                 publicKey="00240000048000009400000006020000002400005253413100040000010001007bff47f8010184
                            497c008c0746887076ac287a483dbea177aaf587fbdf0a50c9bae1965ddd2113fa9cd31ea9d096
                            56b32d893dda8c1bdf6f5bee210d8d9cdb0936cae0cf83669db55304b228a8f4e68b1ea71ececa
                            e3f9115dd72ab430fe489242b09d1dec2eb2cc4f35d01e207805c0aaa5e30e99e812bc98d08756
                            a6b134b1" />
      </fullTrustAssemblies>

    </system.web>

    <neatUpload defaultStorageProvider="SqlServerUploadStorageProvider">
      <providers>
        <add name="SqlServerUploadStorageProvider" type="Hitone.Web.SqlServerUploader.SqlServerUploadStorageProvider, Hitone.Web.SqlServerUploader"
             defaultStorageProvider="SqlServerUploadStorageProvider"
             connectionName="ArtistZone.Data"
             createProcedure="CreateBlob"
             openProcedure="OpenBlob"
             readProcedure="ReadBlob"
             writeProcedure="WriteBlob"
             deleteProcedure="DeleteBlob"
             cleanupProcedure="CleanUpBlob"
             renameProcedure="RenameBlob" />
      </providers>
    </neatUpload>

    <system.webServer>
        <directoryBrowse enabled="false" />

        <modules runAllManagedModulesForAllRequests="true">
          <add name="UploadHttpModule" type="Brettle.Web.NeatUpload.UploadHttpModule, Brettle.Web.NeatUpload" preCondition="managedHandler" />
        </modules>
       
        <validation validateIntegratedModeConfiguration="false" />       
       
        <rewrite>
          <rules>
            <rule name="LowerCaseRule1" stopProcessing="true">
              <match url="[A-Z]" ignoreCase="false" />
              <action type="Redirect" url="{ToLower:{URL}}" />
            </rule>
            <rule name="Redirect non-www to www" patternSyntax="Wildcard" stopProcessing="true">
              <match url="*" />
              <conditions>
                <add input="{HTTP_HOST}" pattern="artistviewpoint.com" />
              </conditions>
              <action type="Redirect" url="http://www.artistviewpoint.com/{R:0}" />
            </rule>
            <rule name="RemoveTrailingSlashRule1" stopProcessing="true">
              <match url="(.*)/$" />
              <conditions>
                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
              </conditions>
              <action type="Redirect" url="{R:1}" />
            </rule>
          </rules>
        </rewrite>
    </system.webServer>

Any ideas on how I may debug this?  I'd appreciate any tip you may have.

Thanks, Loc Pham

Jun 21, 2011 at 4:41 PM

Is anyone actually reading this forum? If you know the answer, please help.

I was able to narrow the problem a bit further.  Seems like the UploadBtn_Clicked event handler sometimes got invoked.  The behavior I'm seeing is very inconsistent.  Sometimes after the first upload, I see UploadBtn_Clicked gets called right away.  On the other hand, it may takes 4 or 5 uploads before I see UploadBtn_Clicked gets called. 

If you can help, please respond.

Thanks,

Loc Pham

 

Jun 22, 2011 at 2:08 PM
Edited Jun 22, 2011 at 4:31 PM

I'm able to find out more detail on this problem, still, I have no solution yet....

After more debugging, the Button which triggered the SqlServerUpload never postback, however the Page_Load event did occur.  Because no postback occurred, the control event handler UploadBtn_Clicked was never invoked.

When I set the triggered button's UseSubmitBehavior="false", the postback did occur, but SqlServerInputFile1.HasFile evaluted to FALSE.

Another interesting fact, when I upload an image that is about 10KB, everything works fine.  When I upload an image that is about 700KB or larger, the problem is reproduced and postback won't occur.

With these information, the postback event is definitely relate to the timing of the file being streamed into the DB. This explain why it works on my local development but does not work on the production.  On my local development, all images 700KB or greater takes about 1 second to complete.  The missing postback is only encountered when streaming the file takes 5 seconds or more ...

So my question remains... where do I set this timeout and why does it occur???

Thanks.

Loc Pham

Jun 23, 2011 at 4:22 PM
Edited Jun 23, 2011 at 4:28 PM

Further debugging....

When I set the connectionString running on my localhost to point to the production DB, the SqlServer upload process works perfectly fine (even with large files).  However, once I deployed my project to the production server, it didn't work with large files (700KB or greater).  The control handler did not fire when I used asp:Button.  When I switched to asp:LinkButton, the handler was fired but then SqlServerInputFile1.HasFile evaluated to false.  I use the same web.config file for both my localhost and production server.

Coordinator
Jun 23, 2011 at 8:58 PM

Hi,

I wish I could be of help, but honestly I've never used the SqlServerUploadStorageProvider myself and have no experience with it and would not know where to begin to try and figure out that one. It seems it must be some server configuration difference rather than a db issue. Even if the Web.config is the same things could be locked down in machine.config (or domain policy if on a windows domain) in a way so that some of the web.config settings doesn't get applied. Or differences in .NET service paks or windows updates or other factors might be something to look at.

Wish I could be of more help but that's all I got.

Best,

Joe