ASMX到WCF的转换 [英] ASMX to WCF Conversion
问题描述
我按照博客上提到的步骤轻松地将我的asmx Web服务转换为wcf服务.一切正常,直到我的wcf服务在框架3.5中为止.但是,一旦我将wcf服务转换为4.0,就无法正确运行我的服务. 我已将ASPNetCompatibilityEnabled设置为true,以实现 HttpContext.Current.Request 和 Server.Mappath .但是,当我将服务转换为4.0时,我不得不将 aspNetCompatibilityEnabled ="false"设置为否则会给我错误:
Could not load type 'System.ServiceModel.Activation.HttpHandler' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
难道我做错了什么?在框架4.0中以最少的工作量我应该怎么做才能将asmx转换为wcf?
尝试从解决方案的引用中删除System.ServiceModel版本3,而从版本4中添加System.ServiceModel. /blockquote>
I converted my asmx web service to wcf service with ease by following the steps mentioned on blogs. Everything worked fine till my wcf service was in framework 3.5. However as soon as I converted my wcf service to 4.0, I am not able to run my service properly. I had aspNetCompatibilityEnabled set to true for compatibility like HttpContext.Current.Request and Server.Mappath. However when I converted my service to 4.0, I had to turn the aspNetCompatibilityEnabled="false" or else it would give me the error:
Could not load type 'System.ServiceModel.Activation.HttpHandler' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'Am I doing something wrong? What more should I do to convert asmx to wcf with minimal effort in framework 4.0?
解决方案Try to remove System.ServiceModel version 3 from the references of the solution and instead add System.ServiceModel from version 4,.
这篇关于ASMX到WCF的转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!