WCF PerSesson InstanceContextMode 防止使用 SVCUtil 生成代理
我有一个 Windows 服务托管 WCF Web 服务。我一直在使用 SVCUTIL 生成代理,一切都工作正常,但今天我将 InstanceContextMode 从 InstanceContextMode.Single 更改为 InstanceContextMode.PerSession现在我收到以下无法隔离的错误。我可以通过更改此设置以外的任何内容来可靠地重新创建错误。有什么想法吗???
这是来自 SVCUTIL 的错误消息
正在生成元数据文件... EXEC : 错误 : 出现错误 导出服务类型: Host.Services.MyService。
调用 WSDL 导出扩展时引发异常:
System.ServiceModel.Description.DataContractSerializerOperationBehavior 合同: http://MySoftware/ServiceContracts/2011/02:IMyService
如下:
[ServiceContract(Namespace = Namespace.Current, SessionMode = SessionMode.Allowed)]
public interface IMyService
服务接口 服务实现现在配置如下:
[ServiceBehavior(Namespace = Namespace.Current, InstanceContextMode = InstanceContextMode.PerSession)]
public class MyService : IMyService
以下是我的配置文件中数据协定序列化器的当前设置
<dataContractSerializer maxItemsInObjectGraph="1000000" />
I have a Windows Service hosted WCF Web Service. I've been generating proxies using SVCUTIL and things have been working fine, but today I changed the InstanceContextMode from InstanceContextMode.Single to InstanceContextMode.PerSession and now I get the below error which I can't isolate. I can reliably recreate the error by changing nothing other then this one setting. Any ideas???
Here is the Error Message from SVCUTIL
Generating metadata files... EXEC : error : There was an error
exporting the service type:
Host.Services.MyService.An exception was thrown in a call to a WSDL export extension:
System.ServiceModel.Description.DataContractSerializerOperationBehavior
contract:
http://MySoftware/ServiceContracts/2011/02:IMyService
The service interface is as follows:
[ServiceContract(Namespace = Namespace.Current, SessionMode = SessionMode.Allowed)]
public interface IMyService
The service implementation is now configured as follows:
[ServiceBehavior(Namespace = Namespace.Current, InstanceContextMode = InstanceContextMode.PerSession)]
public class MyService : IMyService
Here is the current setting in my config file for the data contract serializer
<dataContractSerializer maxItemsInObjectGraph="1000000" />
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这似乎与实例上下文模式无关。
请尝试以下操作:
This doesn't seem to be related to the instance context mode.
Try the following: