Hitone.Web.SqlServerUploader.SqlServerUploadedFile is not marked as serializable

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

Hitone.Web.SqlServerUploader.SqlServerUploadedFile is not marked as serializable

Guest-832
I unzipped NeatUpload-trunk.786.zip and added a virtual directory to IIS on winxp

when I try to upload a file using sqlserver I get this error:

Server Error in '/neatupload' Application.

Type 'Hitone.Web.SqlServerUploader.SqlServerUploadedFile' in Assembly 'Hitone.Web.SqlServerUploader, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.

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.Runtime.Serialization.SerializationException: Type 'Hitone.Web.SqlServerUploader.SqlServerUploadedFile' in Assembly 'Hitone.Web.SqlServerUploader, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[SerializationException: Type 'Hitone.Web.SqlServerUploader.SqlServerUploadedFile' in Assembly 'Hitone.Web.SqlServerUploader, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.]
System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type) +2700482
System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type type, StreamingContext context) +245
System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo() +88
System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter) +175
System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter) +50
System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck) +438
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck) +131
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph) +13
System.Web.UI.ObjectStateFormatter.SerializeValue(SerializerBinaryWriter writer, Object value) +3010

[ArgumentException: Error serializing value 'Brettle.Web.NeatUpload.UploadState' of type 'Brettle.Web.NeatUpload.UploadState.']
System.Web.UI.ObjectStateFormatter.SerializeValue(SerializerBinaryWriter writer, Object value) +3217
System.Web.UI.ObjectStateFormatter.Serialize(Stream outputStream, Object stateGraph) +126
System.Web.UI.ObjectStateFormatter.Serialize(Object stateGraph) +52
System.Web.UI.LosFormatter.Serialize(Stream stream, Object value) +41
Brettle.Web.NeatUpload.SelfSerializingObject.Serialize(Stream s) +39
Brettle.Web.NeatUpload.ObjectProtector.Protect(Serializer serializer, Byte[] encryptionKey, Byte[] validationKey) +115
Brettle.Web.NeatUpload.SimpleWebRemoting.MakeRemoteCall(Uri uri, HttpCookieCollection httpCookies, Byte[] encryptionKey, Byte[] validationKey, Object[] methodCall) +637
Brettle.Web.NeatUpload.SimpleWebRemoting.MakeRemoteCall(Uri uri, Object[] methodCall) +58
Brettle.Web.NeatUpload.SessionBasedUploadStateStoreProvider.MakeRemoteCall(Object[] methodCall) +106
Brettle.Web.NeatUpload.SessionBasedUploadStateStoreProvider.MergeAndSave(UploadState uploadState) +162
Brettle.Web.NeatUpload.UploadStateStore.UploadState_Changed(Object sender, EventArgs args) +244
Brettle.Web.NeatUpload.UploadState.OnChanged() +29
Brettle.Web.NeatUpload.UploadState.set_Status(UploadStatus value) +174
Brettle.Web.NeatUpload.UploadHttpModule.Application_ResolveRequestCache(Object sender, EventArgs e) +220
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +92
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64


Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433
Reply | Threaded
Open this post in threaded view
|

Re: Hitone.Web.SqlServerUploader.SqlServerUploadedFile is not marked as serializable

Dean Brettle
Administrator
Definitely sounds like a bug.  I'll try to reproduce it here and get a fix out.  In the meantime, if you are not using a web garden/farm you might be able to workaround it by configuring NeatUpload to use the InProcUploadStateStoreProvider as described in Reducing Server Load.

--Dean
Reply | Threaded
Open this post in threaded view
|

Re: Hitone.Web.SqlServerUploader.SqlServerUploadedFile is not marked as serializable

Guest-832
is that change will still upload to a sql server 2000?

I cannot test it until tomorrow
Reply | Threaded
Open this post in threaded view
|

Re: Hitone.Web.SqlServerUploader.SqlServerUploadedFile is not marked as serializable

Dean Brettle
Administrator
Both the workaround I mentioned and the fix I am working on should work with SQL Server 2000.

--Dean
Reply | Threaded
Open this post in threaded view
|

Re: Hitone.Web.SqlServerUploader.SqlServerUploadedFile is not marked as serializable

Guest-832
I just tried it and when I load the demo page DBWrite.aspx I get this error

I'm sure i'm doing something wrong somwhere...

Server Error in '/neatupload' Application.

Object reference not set to an instance of an object.

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.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]
Brettle.Web.NeatUpload.FileControl.get_StorageConfig() +339
Brettle.Web.NeatUpload.InputFile.Render(HtmlTextWriter writer) +413
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +25
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +121
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +199
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +20
System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) +59
System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output) +68
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +25
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +121
System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer) +37
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +199
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +20
System.Web.UI.Page.Render(HtmlTextWriter writer) +26
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +25
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +121
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2558


Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433



this is my web.config file

<?xml version="1.0"?>
<configuration>
  <configSections>
            <section name="neatUpload" requirePermission="false" type="Brettle.Web.NeatUpload.ConfigSectionHandler, Brettle.Web.NeatUpload" allowLocation="true" />

  </configSections>
 
  <connectionStrings>
    <add connectionString="Password=mypass;Persist Security Info=True;User ID=myuser;Initial Catalog=mycat;Data Source=mysource" name="default"/>
  </connectionStrings>

  <neatUpload xmlns="http://www.brettle.com/neatupload/config/2008"
            useHttpModule="true" defaultStorageProvider="dbProcUploader">
    <providers>
      <add name="dbProcUploader" type="Brettle.Web.NeatUpload.InProcUploadStateStoreProvider, Brettle.Web.NeatUpload" connectionName="default" createProcedure="CreateBlob" openProcedure="OpenBlob" readProcedure="ReadBlob" writeProcedure="WriteBlob" deleteProcedure="DeleteBlob" cleanupProcedure="CleanUpBlob" renameProcedure="RenameBlob" storeHashProcedure="FinalizeBlob" hashAlgorithm="MD5"/>
    </providers>
    </neatUpload>
</configuration>
Reply | Threaded
Open this post in threaded view
|

Re: Hitone.Web.SqlServerUploader.SqlServerUploadedFile is not marked as serializable

Dean Brettle
Administrator
I suspect this might be a separate issue.  Do you get the same error when you load the Brettle.Web.NeatUpload\Demo.aspx page?  What does your root Web.config look like?

Can you run in the IDE and give me a line number for that exception, or tell me what is null?

--Dean
Reply | Threaded
Open this post in threaded view
|

Re: Hitone.Web.SqlServerUploader.SqlServerUploadedFile is not marked as serializable

Guest-832
the demo.aspx page run without problem and from the IDE I cannot catch the line number where the exeption happen but after looking at the code and the fact that the exception above is saying byte 339 in Brettle.Web.NeatUpload.FileControl.get_StorageConfig() I think the problem come from the line 81 in file FileControl.cs under the folder "NeatUpload-trunk.786\dotnet\src\Brettle.Web.NeatUpload\Brettle.Web.NeatUpload" but I'm not 100% sure



root web.config is the default one, I don't remember changing something but here it is:

<?xml version="1.0"?>

<configuration>

      <configSections>

            <!--Under .NET 2.0, use this instead:-->

                  <section name="neatUpload" requirePermission="false" type="Brettle.Web.NeatUpload.ConfigSectionHandler, Brettle.Web.NeatUpload" allowLocation="true" />

 

            <!-- <section name="neatUpload" type="Brettle.Web.NeatUpload.ConfigSectionHandler, Brettle.Web.NeatUpload" allowLocation="true"/>

      --></configSections>

      <system.web>

            <!--

            <trust level="Medium" />

-->

            <compilation debug="true">

                  <assemblies>

                        <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/></assemblies></compilation>

            <trace enabled="false" requestLimit="5000" pageOutput="true" traceMode="SortByTime" localOnly="false"/>

            <httpRuntime useFullyQualifiedRedirectUrl="true"/>

            <httpModules>

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

            </httpModules>

            <customErrors mode="Off">

                  <error statusCode="413" redirect="~/NeatUpload/Error413.aspx"/>

            </customErrors>

            <!--

    <sessionState mode="InProc" cookieless="true" stateConnectionString="tcpip=127.0.0.1:42424"/>

            <sessionState mode="StateServer" cookieless="false" stateConnectionString="tcpip=127.0.0.1:42424"/>

            -->

      </system.web>

      <neatUpload xmlns="http://www.brettle.com/neatupload/config/2008"

          useHttpModule="false"

          maxNormalRequestLength="4096"

          maxRequestLength="2097151"

          defaultStorageProvider="FilesystemUploadStorageProvider"

          defaultStateStoreProvider="SessionBasedUploadStateStoreProvider">

            <providers>

                  <add name="FilesystemUploadStorageProvider" type="Brettle.Web.NeatUpload.FilesystemUploadStorageProvider, Brettle.Web.NeatUpload"/>

                  <add name="SessionBasedUploadStateStoreProvider" type="Brettle.Web.NeatUpload.SessionBasedUploadStateStoreProvider, Brettle.Web.NeatUpload"/>

            </providers>

      </neatUpload>

      <location path="Brettle.Web.NeatUpload/Demo.aspx">

            <system.web>

                  <httpRuntime maxRequestLength="2097151" executionTimeout="3600" useFullyQualifiedRedirectUrl="true"/>

            </system.web>

            <neatUpload useHttpModule="true" xmlns="http://www.brettle.com/neatupload/config/2008"/>

      </location>

      <system.webServer>

            <modules>

                  <add name="UploadHttpModule" type="Brettle.Web.NeatUpload.UploadHttpModule, Brettle.Web.NeatUpload" preCondition="managedHandler"/>

            </modules>

            <validation validateIntegratedModeConfiguration="false"/>

      </system.webServer>

      <!--

      <appSettings>

        <add key="NeatUpload.Logger" value="ConsoleLogger"/>

      </appSettings>

-->

</configuration>

 

Reply | Threaded
Open this post in threaded view
|

Re: Hitone.Web.SqlServerUploader.SqlServerUploadedFile is not marked as serializable

Dean Brettle
Administrator
It doesn't look like you are using the workaround I suggested.  Specifically, in the root Web.config:

...
<neatUpload xmlns="http://www.brettle.com/neatupload/config/2008"

          useHttpModule="false"

          maxNormalRequestLength="4096"

          maxRequestLength="2097151"

          defaultStorageProvider="FilesystemUploadStorageProvider"

          defaultStateStoreProvider="InProcUploadStateStoreProvider">

            <providers>

                  <add name="FilesystemUploadStorageProvider" type="Brettle.Web.NeatUpload.FilesystemUploadStorageProvider, Brettle.Web.NeatUpload"/>

                  <add name="InProcUploadStateStoreProvider" type="Brettle.Web.NeatUpload.InProcUploadStateStoreProvider, Brettle.Web.NeatUpload"/>

            </providers>

      </neatUpload>

--Dean

Reply | Threaded
Open this post in threaded view
|

Re: Hitone.Web.SqlServerUploader.SqlServerUploadedFile is not marked as serializable

Guest-832
I modified the root web.config like you said

demo.aspx still work perfectly but the dbwrite.aspx still doesn't work with the same error.

ha yes, thanks for your time
Reply | Threaded
Open this post in threaded view
|

Re: Hitone.Web.SqlServerUploader.SqlServerUploadedFile is not marked as serializable

Dean Brettle
Administrator
Also please try NeatUpload-1.3.0 which I just released, to see if that helps.
--Dean
Reply | Threaded
Open this post in threaded view
|

Re: Hitone.Web.SqlServerUploader.SqlServerUploadedFile is not marked as serializable

Guest-832
Hello

I still get an error.

After extracting to a new directory and setting up IIS on winxp sp2, I just modified the local web.config in apps/Extensions/Hitone.Web.SqlServerUploader to make it look like this:


<?xml version="1.0"?>

<configuration>

  <connectionStrings>

    <add connectionString="Password=pass;Persist Security Info=True;User ID=user;Initial Catalog=segmentation;Data Source=src" name="default"/>

  </connectionStrings>

 

  <neatUpload xmlns="http://www.brettle.com/neatupload/config/2008"

              useHttpModule="true" defaultStorageProvider="dbProcUploader">

    <providers>

      <add name="dbProcUploader" type="Hitone.Web.SqlServerUploader.SqlServerUploadStorageProvider, Hitone.Web.SqlServerUploader" connectionName="default" createProcedure="CreateBlob" openProcedure="OpenBlob" readProcedure="ReadBlob" writeProcedure="WriteBlob" deleteProcedure="DeleteBlob" cleanupProcedure="CleanUpBlob" renameProcedure="RenameBlob" storeHashProcedure="FinalizeBlob" hashAlgorithm="MD5"/>

    </providers>

  </neatUpload>

</configuration>


the error, after trying to upload a jpg file, is:

Server Error in '/neatupload' Application.

Object reference not set to an instance of an object.

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.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

[No relevant source lines]

Source File: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\neatupload\ea36cd6f\605f9055\App_Web_h9rifhlp.1.cs    Line: 0

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]
System.Security.Cryptography.HashAlgorithm.get_Hash() +26
Hitone.Web.SqlServerUploader.SqlServerUploadedFile.SaveHash() +226
Hitone.Web.SqlServerUploader.SqlServerUploadedFile.Dispose() +72
Brettle.Web.NeatUpload.FileControl.OnUnload(EventArgs e) +43
System.Web.UI.Control.UnloadRecursive(Boolean dispose) +257
System.Web.UI.Control.UnloadRecursive(Boolean dispose) +197
System.Web.UI.Control.UnloadRecursive(Boolean dispose) +197
System.Web.UI.Page.UnloadRecursive(Boolean dispose) +20
System.Web.UI.Page.ProcessRequestCleanup() +40
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +213
System.Web.UI.Page.ProcessRequest() +86
System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +18
System.Web.UI.Page.ProcessRequest(HttpContext context) +49
ASP.extensions_hitone_web_sqlserveruploader_dbwrite_aspx.ProcessRequest(HttpContext context) in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\neatupload\ea36cd6f\605f9055\App_Web_h9rifhlp.1.cs:0
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +358
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64


Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433
Reply | Threaded
Open this post in threaded view
|

Re: Hitone.Web.SqlServerUploader.SqlServerUploadedFile is not marked as serializable

Dean Brettle
Administrator
Thanks for the bug report.  I see what the problem is and should have a fix out in the next day or so.  Until then, you can workaround the problem by removing the hashAlgorithm attribute.

Thanks again,
--Dean
Reply | Threaded
Open this post in threaded view
|

Re: Hitone.Web.SqlServerUploader.SqlServerUploadedFile is not marked as serializable

Dean Brettle
Administrator
Fixed in 1.3.1 which I just released.
--Dean
Reply | Threaded
Open this post in threaded view
|

Re: Hitone.Web.SqlServerUploader.SqlServerUploadedFile is not marked as serializable

Guest-832
I just tried 1.3.1

it's working! thanks