Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old May 28th, 2006, 07:01 AM
Authorized User
Join Date: May 2004
Posts: 83
Thanks: 0
Thanked 1 Time in 1 Post
Default SerializationException in Enterprise Services

I've developed a distributed app in C#. The various components of the application are as follows:

A SQL Server database.
Data Access Layer - Hosted in COM+ as Library application.
Business Logic Layer - Hosted in COM+ as Server application.
User Interface (Windows-based).
Types - Exposes various typed DataSet objects used by DAL, BLL, and UI.
ServerHost - A Console app that exposes the BLL objects via remoting.
The application is hosted on a machine running Windows XP SP2. The DAL and BLL are both hosted in COM+ on the same server that hosts the SQL Server database. Both of these projects and the UI project reference the Types library that, among other things, has strongly typed DataSet objects that are used by the other three (DAL, BLL, and UI) projects. The DAL and BLL (hosted in COM+) are made available to remote clients via .NET Remoting. The issue is that data is serialized successfully from DAL to BLL to UI. However, it doesn't work the other way around. When I send updated data back to the server, it fails. The exception thrown is SerializationException. The error message reads "Because of security restrictions, the type CustomerDataSet cannot be accessed." InnerException of the exception thrown (SerializationException) is SecurityException and its error message reads "Request failed."

I've no idea if the same DataSet is serialized from server to the client successfully, why isn't it getting serialized the other way around? Any ideas?

Note: I've created a striped down version of the same project based on the Northwind SQL Server database. This project follows the same architecture (used in the original application) around the Customer table of the Northwind database. So, if any one needs the sample application that is capable of producing the errors just described, please send me an email at ehsanullahjan@gmail.com.

Your help is greatly appreciated.

Old May 28th, 2006, 08:02 AM
Authorized User
Join Date: May 2004
Posts: 83
Thanks: 0
Thanked 1 Time in 1 Post

Some more interesting elaboration on this topic. For testing purposes, I developed an exact replica of the described application in .NET 2.0 and everything is working perfectly fine! Even more interesting is the fact that in migrating the v1.1 app to v2.0, I didn't need to make any change to the code!!

In .NET 2.0, one of the Membership Conditions (in Code Access Security) is GAC (Global Assembly Cache). All assemblies that are installed in the GAC are automatically assigned the FullTrust PermissionSet. This shouldn't be a problem in the v1.1 app, however, because I'm running all the components locallly on a single machine (for debugging purposes). And assemblies in MyComputer zone are assigned the FullTrust PermissionSet by default. Nevertheless, to give the v1.1 app a fair fighting chance, I created a StrongName Membership condition and assigned the StrongName I used to sign all the assemblies in the v1.1 app FullTrust PermissionSet. I made all the config. changes thru the respective MMC snap-ins. With full trust the issue should have been resolved but it didn't. Can't figure out what might be wrong.

Any ideas?


Similar Threads
Thread Thread Starter Forum Replies Last Post
SerializationException - Why? rasmuse C# 1 July 9th, 2007 08:38 AM
enterprise library sarah lee ASP.NET 2.0 Basics 2 January 9th, 2007 03:42 PM
Enterprise Manager Jan_Ma SQL Server ASP 1 October 17th, 2003 08:45 AM
Enterprise Manager Jan_Ma Classic ASP Databases 1 October 17th, 2003 08:44 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.