RE: Problem deserializing file from asp.net

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



You can get a better description of the error by:
1) Turning the customErrors to Off in the web.config,
2) Enclosing your code in a try catch, e.g.
Try

Catch ex As Exception
Response.Write(ex.ToString)
End Try

As for the file permissions you need to give the ASPNET account write access
also to the folder pointed to by the SerialiseFileName variable in your code.

HTH
--
Phillip Williams
http://www.societopia.net
http://www.webswapp.com


"Steve Bugden" wrote:

> Hi,
>
> I am using the XmlSerializer class to deserialize a file, please see
> attached code.
>
> This works fine from a windows form, but fails when called from an asp.net
> web service. Unfortuantely I can't get a proper error message, the browser
> just a "this page cannot be displayed" message.
>
> I have read that the account the service runs under requires write access to
> the .net framework temp directory which it has.
>
> Could anyone give me any pointers as to why this could be failing.
>
> Many thanks for any suggestions,
>
> Steve
>
> Dim serializer As New XmlSerializer(GetType(MyClass))
> Dim fstFileStream As FileStream
> Dim MyObject As MyClass
> 'Deserialise the file to create the main web site object
> serializer = New XmlSerializer(GetType(MyClass))
> fstFileStream = New FileStream(Me.SerialiseFileName,
> FileMode.Open)
> 'Ensure the object is updated
> 'Force the full model to be created
> MyObject = CType(serializer.Deserialize(fstFileStream), MyClass)
> If Not fstFileStream Is Nothing Then
> fstFileStream.Close()
> fstFileStream = Nothing
> End If
.



Relevant Pages

  • Re: Web Service Security problem
    ... The web service project should hav a web.config. ... Allowin that account access to lan resources would be a large security risk. ... > different username that is known to the domain server? ... > Another possible issue is the ASPNET account on the server. ...
    (microsoft.public.dotnet.framework.aspnet.webservices)
  • Re: Using HttpContext from a web server?
    ... web service to web service could result in the Context.User on the ... If you have some code running in ... process account which is the ASPNET account by default on Win2K. ... It might even work if there were both the same server. ...
    (microsoft.public.dotnet.security)
  • Re: Web Service with Admin rights
    ... The so called "ASP.NET Webservices" are run under ASPNET account, ... > I want to create a web service that can create the users in the ... I am using ADSI for that. ... > in the windows domain. ...
    (microsoft.public.dotnet.framework.aspnet.webservices)
  • Problem deserializing file from asp.net
    ... This works fine from a windows form, but fails when called from an asp.net ... web service. ... Unfortuantely I can't get a proper error message, ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: accessing registry from web service
    ... I guess the ASPNET account (which are the credentials under which your ... >i made a web service that call a function to access registry ... > Dim RegKey As Microsoft.Win32.RegistryKey ...
    (microsoft.public.dotnet.framework.webservices)