sliverlight: The remote server returned an error: NotFound.

本文介绍了一种在Silverlight应用中使用WCF服务进行会话管理的方法。由于Silverlight本身不支持会话管理,作者通过配置ASP.NET兼容性并利用HTTP上下文来实现会话的设置和获取。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

.Background 

 

I want to use the session in sliverlight, so I create wcf set Session and get Session. 

why use the wcf operate the session? because the sliverlight don't support the session .

 

.phenomenon

I create the wcf

1)add the" <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>" in web.config.

 

2) modify the services class " [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]"

 

 

3)add namespace "System.web" to project. Now you can use the httpcontext.current.seesion .

 

4) I add two method in service class (getSession and setSession) ,  code is here:

 

 

when I call login function ,I will save the member data to the session. this logic is right.

but another page getSession that throw the "The remote server returned an error: NotFound".

I am so grief, I search the resources that explain the server side or client side have error setting.

I think this error it is the client side don't know what type return.  because I return object don't member data.

but I set the session is member data. 

 

.solution

I modify the getSession function return the member data ,this problem have fixed. 

why the wcf don't know convert the object to member ? my function cann't hardcode member type.

I think use the serviceknowtype will fix this problem ,so I try is ok.

 

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

田猿笔记

写文章不容易,希望大家小小打赏

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值