简体   繁体   English

Unity,Dll上的WebServices,与.Net 4.0兼容

[英]WebServices on Unity, Dll, compatibility with .Net 4.0

I'm trying to use web services on unity. 我试图统一使用Web服务。 I used svcutil to generate a proxy class, however the proxy class was using "System.Threading.Tasks". 我使用svcutil生成了一个代理类,但是该代理类正在使用“ System.Threading.Tasks”。

I noticed that System.Threading.Tasks wasn't aviable on .Net 3.5. 我注意到System.Threading.Tasks在.Net 3.5上不可用。 So I went to player setting and I changed to .Net 4.x 所以我转到播放器设置,然后更改为.Net4.x。

But now I have an other issue, and I cannot find a way to fix it, I need to use System.Web.dll and System.Web.Services.dll to make my web service work, however, the dll that are include in Program Files\\Unity\\Editor\\Data\\Mono\\lib\\mono\\2.0 are all targets for .Net 3.5. 但是现在我还有另一个问题,我找不到解决方法,我需要使用System.Web.dll和System.Web.Services.dll使我的Web服务正常工作,但是,包含在其中的dll程序文件\\ Unity \\ Editor \\ Data \\ Mono \\ lib \\ mono \\ 2.0 都是.Net 3.5的目标。

So that mean I cannot use them on .Net 4.x 所以这意味着我不能在.Net 4.x上使用它们

I've been looking for quiet long and was unable to find any answer. 我一直在寻找安静的地方,无法找到任何答案。 I can add the code to the proxy class here if it's require, but I don't think it would be useful. 如果需要,我可以在这里将代码添加到代理类中,但是我认为这没有用。 Should I download those dll somewhere? 我应该在某个地方下载那些dll吗? Anyone ever seen thoses issues somewhere? 有人在某个地方见过这些问题吗?

You are using the wrong dll version. 您使用了错误的dll版本。

Once you change Api Compatibility Level to Net 4.x, you have to copy the System.Web.dll and System.Web.Services.dll files from <UnityInstallationDirectory>\\Editor\\Data\\MonoBleedingEdge\\lib\\mono\\4.5 to your <Project>\\Assets path. Api Compatibility Level更改为Net 4.x后,必须将System.Web.dllSystem.Web.Services.dll文件从<UnityInstallationDirectory>\\Editor\\Data\\MonoBleedingEdge\\lib\\mono\\4.5<Project>\\Assets路径。

That's it. 而已。 Restart Visual Studio and Unity. 重新启动Visual Studio和Unity。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM