Azure的应用程序的API代理生成错误 [英] Azure API App proxy generation error

查看:240
本文介绍了Azure的应用程序的API代理生成错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是能够成功地创建一个测试API和主机在Azure上。然而,当我尝试创建代理客户端,我收到以下错误。

I was able to successfully create a test API and host in Azure. However when I try to create the proxy client, I receive the following error.

[致命]错误发生的服务模式:'获取'的经营有一个体
  参数,但没有一个支持的MIME类型(应用/ JSON)
  在其消费属性。

  异常:有code过程中发生错误
  当一代试图添加一个客户端的微软Azure API应用

  生成客户code和增加项目失败。

[Fatal]Error generating service model: The operation 'Get' has a body parameter, but did not have a supported MIME type ('application/json') in its Consumes property.
Exception: There was an error during code generation when trying to add a client for the Microsoft Azure API App
Generating client code and adding to project failed

我检查了扬鞭文件和包含节点是空的。当我将其更改为

I checked the Swagger file and the Contains node was empty. When I change it to

消耗:[
              应用/ JSON
              应用程序/ XML
            ]

"consumes": [ "application/json", "application/xml" ]

代理创作的作品。为什么自动生成的json扬鞭没有包含属性集?我用默认SwaggerConfig去了,当我创建的API应用程序。我缺少一些配置?任何帮助将大大AP preciated。

the proxy creation works. Why did the auto-generated Swagger json not have the Contains property set? I went with the default SwaggerConfig when I created the API app. Am I missing some configuration? Any help will be greatly appreciated.

推荐答案

当我从注释中发现,解决的办法是去除Htt的prequestMessage作为行动参数。这将使API应用程序客户机生成code OK。

As I found out from the comments, the solution is to to remove the HttpRequestMessage as parameter of the Action. This will enable the API App Client to generate the code OK.

如果您需要模拟对象,请遵循的这里或另一个例子的这里

If you need to mock the object, please follow the documented way from here or another example here.

这篇关于Azure的应用程序的API代理生成错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆