Tag: web

Unity GET / POST Wrapper

这是C#问题中的Unity3d。 目标是创建一个对象,以便我可以传入URL并通过GET接收数据,我将创建一个对象,它将成为WWW逻辑的包装器。 我也想要一个’POST’对象,在那里我可以提供一个url和一个键值对的’Dictionary’作为post争论。 Sooo ……我们最终会喜欢这样的东西: get_data = GET.request(“http://www.someurl.com/somefile.php?somevariable=somevalue”); 和 post_data = POST.request(“http://www.someurl.com/somefile.php”, post) // Where post is a Dictionary of key-value pairs of my post arguments. 为了尝试实现这一点,我使用了WWW对象。 现在,为了给WWW对象下载时间,我们需要在MonoBehaviour对象中发生这种情况并yield结果。 所以我得到了这个,它有效: public class main : MonoBehavior { IEnumerator Start() { WWW www = new WWW(“http://www.someurl.com/blah.php?action=awesome_stuff”); yield return www; Debug.Log(www.text); } } 我真正想要的是: public class main : MonoBehavior […]

使用URI类时保持url编码

我正在尝试从LinkedIn获取公开个人资料信息。 要实现这一点,我必须提供 http://api.linkedin.com/v1/people/url=public-profile-url ,其中public-profile-url必须是URL编码的。 问题是,像HttpClient,WebRequest等.NET类使用Uri类,它似乎“封装”了提供的URL,因此我无法获得正确的格式化请求。 URI必须是: http://api.linkedin.com/v1/people/url=http%3a%2f%2fwww.linkedin.com%2fin%2fiftachragoler 但是: http://api.linkedin.com/v1/people/url=http://www.linkedin.com/in/iftachragoler 通过这种方式,我从LinkedIn收到’Bad Request’。 有什么方法可以让Uri / UriBuilder不解码该URL吗?

ASP.NET网站生产服务器上的性能下降

我的问题是我的ASP.NET网站在我的生产服务器上比我的开发服务器上运行速度慢。 在我的开发环境中在120ms内执行的页面需要400ms才能在服务器上执行。 我使用分析器监视SQL服务器,并且在服务器上运行400ms的页面上运行的查询只需要大约50ms即可完成 – 所以我确信自己的问题不在于SQL服务器。 我的开发机器是Intel I7,配备6GB RAM,生产服务器是2x AMD四核,16GB内存。

在streamingAssetsPath上读写文件

这是我在android中读取我的文本文件的方式。 #if UNITY_ANDROID string full_path = string.Format(“{0}/{1}”,Application.streamingAssetsPath, path_with_extention_under_streaming_assets_folder); // Android only use WWW to read file WWW reader = new WWW(full_path); while (!reader.isDone){} json = reader.text; // PK Debug 2017.12.11 Debug.Log(json); #endif 这就是我从pc上读取我的文本文件的方法。 #if UNITY_STANDALONE string full_path = string.Format(“{0}/{1}”, Application.streamingAssetsPath, path_with_extention_under_streaming_assets_folder); StreamReader reader = new StreamReader(full_path); json = reader.ReadToEnd().Trim(); reader.Close(); #endif 现在我的问题是我不知道如何在移动设备上编写文件因为我在独立版上这样做 #if UNITY_STANDALONE StreamWriter […]