冲突的DLL
当我在 wcf 项目中使用“System.Net.HttpStatusCode”时,我收到以下错误。
类型“System.Net.HttpStatusCode”存在于“C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll”和“D:\HKMP\Branch\NewAmelio\amelioSL\Web\Services\bin”中\System.Net.dll'
HttpResponseMessageProperty property = new HttpResponseMessageProperty();
// Here the response code is changed to 200.
property.StatusCode = System.Net.HttpStatusCode.OK;
Iam getting following error when iam using 'System.Net.HttpStatusCode' in my wcf project.
The type 'System.Net.HttpStatusCode' exists in both 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll' and 'D:\HKMP\Branch\NewAmelio\amelioSL\Web\Services\bin\System.Net.dll'
HttpResponseMessageProperty property = new HttpResponseMessageProperty();
// Here the response code is changed to 200.
property.StatusCode = System.Net.HttpStatusCode.OK;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在您的 Visual Studio 项目中,您是否有对 System.Net.dll 的引用标记为“复制本地”?在解决方案资源管理器中选择引用,然后按 F4 打开属性网格。您需要确保“复制本地”设置为“false”,因为此引用已在每台安装了 .NET Framework 的计算机上可用。
然后,您还需要删除项目文件夹中的 System.Net.dll 的任何副本,并从源代码管理中将其删除。
In your Visual Studio project do you have the reference to System.Net.dll marked as "Copy Local"? Select the reference in Solution Explorer and then press F4 to open the property grid. You'll want to make sure that Copy Local is set to "false" because this reference is already available on every computer with the .NET Framework installed.
You'll then also want to delete any copy of System.Net.dll that you have in your project folder as well as delete it from source control.