gpt4 book ai didi

c# - 无法在 WP 上调用必应翻译服务

转载 作者:太空宇宙 更新时间:2023-11-03 16:22:21 25 4
gpt4 key购买 nike

迁移后,微软在 Bing Translation 上提供少量功能的好日子一去不复返了。并且新帐户 key 仅对新服务根有效:

https://api.datamarket.azure.com/Data.ashx/Bing/MicrosoftTranslator/v1 

而不是像这样的东西:

http://api.microsofttranslator.com/V1/SOAP.svc

或:

http://api.microsofttranslator.com/V1/SOAP.svc

这还没有结束。当我尝试向它添加服务引用时,VS 只是说:

EntityType 'Microsoft.Translation' has no key defined. Define the key for this EntityType.

或者在权限上抛出一些异常。

在此之前,我尝试使用订阅附带的 Helper 类。我花了很长时间修改用于 WP8 的代码 - 关于 System.Data.Services.Client 上的一些问题(客户端上的 WCF 5 导致的一些不兼容?)和异步调用。结果是:

System.InvalidOperationException:There is a type mismatch between the client and the service. Type 'Microsoft.Translation' is not an entity type, but the type in the response payload represents an entity type. Please ensure that types defined on the client match the data model of the service, or update the service reference on the client.

我检查了响应,没有发现任何错误:

After the migration, gone are the good old days when Microsoft provides a handful of functions on Bing Translation. And new account keys are only valid to the new service root:

https://api.datamarket.azure.com/Data.ashx/Bing/MicrosoftTranslator/v1

而不是像这样的东西:

http://api.microsofttranslator.com/V1/SOAP.svc

或:

http://api.microsofttranslator.com/V1/SOAP.svc

这还没有结束。当我尝试向它添加服务引用时,VS 只是说:

EntityType 'Microsoft.Translation' has no key defined. Define the key for this EntityType.

或者在权限上抛出一些异常。

在此之前,我尝试使用订阅附带的 Helper 类。我花了很长时间修改用于 WP8 的代码 - 关于 System.Data.Services.Client 上的一些问题(客户端上的 WCF 5 导致的一些不兼容?)和异步调用。结果是:

System.InvalidOperationException:There is a type mismatch between the client and the service. Type 'Microsoft.Translation' is not an entity type, but the type in the response payload represents an entity type. Please ensure that types defined on the client match the data model of the service, or update the service reference on the client.

我检查了响应,没有发现任何错误:

微软翻译 https://api.datamarket.azure.com/Data.ashx/Bing/MicrosoftTranslator/v1/Translate?Text='hello'&To='nl' 2012-11-22T23:20:10Z https://api.datamarket.azure.com/Data.ashx/Bing/MicrosoftTranslator/v1/Translate?Text='hello'&To='nl'&$skip=0&$top=1 翻译 2012-11-22T23:20:10Z 你好 (抱歉,xml 显示不正确。)

我什至尝试使用传统方法访问 OData,但都是徒劳。老实说有点生气......

我已经用 google 搜索了足够多,但仍然找不到新的必应翻译界面的解决方案。有没有人和我有类似的问题?提前致谢。

我什至尝试使用传统方法访问 OData,但都是徒劳。老实说有点生气......

我已经用 google 搜索了足够多,但仍然找不到新的必应翻译界面的解决方案。有没有人和我有类似的问题?提前致谢。

最佳答案

这里有一个关于如何在 Windows Phone 7 中执行此操作的教程: http://blogs.msdn.com/b/translation/p/wp7translate.aspx

请务必在 Azure 上正确获取您的客户端 ID 和客户端密码——为此请在 https://datamarket.azure.com/developer/applications 注册您的应用程序

使用您在此处注册的应用程序的客户端 ID 和客户端密码,而不是您整个 Azure 帐户的客户端 ID 和客户端密码。

此外,如果您遇到错误,最好确保您对翻译器的订阅处于事件状态。您可以在以下位置进行检查: https://datamarket.azure.com/account/datasets

关于c# - 无法在 WP 上调用必应翻译服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13521607/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com