Web API返回空字符串,不是状态数据为200的预期数据

问题描述

我们有一个Web API,它可以在一种环境中工作,而不能在另一种环境中工作。没有错误,它只返回带有200状态代码的空字符串。即使只是从Web API返回“ Hello World”,也是如此。什么会导致此问题?我是Web解决方案的新手,并希望获得帮助。

这是外部webApI控制器dll,出于测试目的,我将代码更改如下:

using Acs.Tkn;
using Acs.Tkn.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http;
using System.Web.Http.Cors;

namespace GalaxyConnect.Controllers
{
    [EnableCors(origins: "*",headers: "*",methods: "*")]
    public class ExternalTokenController : ApiController
    {


        
           [HttpGet]
           public String Get(long clientGuid,long visitGuid,long chartGuid,long userGuid,long workstationGuid,string token,TokenFormat format = TokenFormat.Rtf)
              {
                  try
                  {

                      return "Hello World";
                    // return TokenCommandRepository.GetToken(clientGuid,visitGuid,chartGuid,userGuid,workstationGuid,token);
                  }
                  catch (Exception ex)
                  {

                      var response = new 
 System.Net.Http.HttpResponseMessage(System.Net.HttpStatusCode.BadRequest);
                      response.Content = new StringContent(ex.Message);
                      throw new HttpResponseException(response);
                  }

              }

             }
}

仍然,它不返回“ Hello World”,而是返回“”。没有错误信息。状态为200。

谢谢

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...