我有一个远程托管对象,它被配置为SingleCall。它是配置为RemotingConfiguration.Configure(remotingConfigPath,false的旧式.Net远程处理对象)。该对象在没有问题的情况下在DataSet中接收一个DataSet字段,并将该字段传递给一个标记为AutoComplete的ServicedComponent (COM+)方法。就呼叫而言,字段是可以的。现在,该AutoComplete方法一旦接收到DateTime,就会移动1小时。当然,它是由.Net框架改变的。中间没有用户代码。我认为,这种变化发生在某些日期,即白天的变化日期。
它必须是具有日期序列化的东西,当它经过AppDomain's时应该会发生。类似于服务组件使用它自己的时区并将接收到的日期转换为该区域。但奇怪的是,如果我直接调用ServicedComponent而没有为.Net远程处理配置它,则不会发生日期更改。ServicedComponent正在进行中。客户端和服务器位于同一台机器中,TimeZone、GMT+2和Regional设置为土耳其/土耳其和.net区域性,客户端的CurrentUICulture和CurrentCulture都设置为tr-TR。请提前帮助解决这个问题谢谢
public class ProfileSystem : MarshalByRefObject
{
public void SaveProfile(Guid sessionId, HotelAToZ.SystemTypes.Profile2.ProfileData data)
{
//This is in remoting object DateTime is received normally here
//Header is a property which just returns the first row of DataSet. Actually only one row in dataset
//throw new ApplicationException(data.Header.BirthDay.ToString());
new Reservation.ReservationSC().SaveProfile(sessionId, data);
}
} [Transaction(TransactionOption.Required)]
public class ReservationSC : ServicedComponent
{
//This is in ServicedComponent
[AutoComplete]
public void SaveProfile(Guid sessionId, HotelAToZ.SystemTypes.Profile2.ProfileData data)
{
//data.Header.BirthDay is shifted here
//throw new ApplicationException(data.Header.BirthDay.ToString());
new HotelAToZ.DataAccess.Profile2.ProfileAccess().SaveProfile(sessionId, data);
}
}发布于 2014-08-26 23:14:29
这个问题是由一个类似的问题:http://social.msdn.microsoft.com/Forums/en-US/19706927-ab22-44ee-ad89-9d005f7ea29f/binary-serialization-of-datasets-bug-with-datetimecolumns?forum=adodotnetdataproviders中描述的bug引起的。
因此,将DataColumn的DateTimeMode属性设置为DataSetDateTime.Unspecified解决了这一问题。
https://stackoverflow.com/questions/25495706
复制相似问题