WCF服务方法不刷新

时间:2015-05-06 15:45:27

标签: c# wcf visual-studio-2013

我正在尝试向WCF服务添加两个新方法。当我通过Visual Studio运行服务时,新方法不会出现在WSDL中。我之前已经为这项服务添加了服务方法,所以我不知道为什么这次我看不到新的方法。

我试过(没有特别的顺序)......

  • 重新启动Visual Studio
  • 重启我的机器
  • 干净并重建
  • 使用fiddler清除缓存
  • 清除浏览器缓存
  • 使用其他浏览器
  • 使用WCF测试客户端
  • 阅读this MS forum
  • 中的回复
  • 阅读this SO post
  • 中的回复
  • 我只是尝试将返回对象更改为不调用DB以查看是否有帮助,没有运气

以上都没有显示新方法

  • 将代码复制到新的Visual Studio项目有效,但不是理想的解决方案

因为复制到新的解决方案我得出结论Visual Studio正在缓存所以我跟着these steps来清除我的Visual Studio缓存。不幸的是,问题仍然存在。以防我在此之后做了一个干净的重建

有没有人看到我是否遗漏了一些愚蠢的东西会导致服务方法无法显示或知道我可以尝试的其他东西?

[ServiceContract]
public interface INTTRunService
{
    //OTHER METHODS HERE

    [OperationContract]
    JsonReturnObject GetWindStationById(int id);

    [OperationContract]
    JsonReturnObject GetWeatherStationById(int id);
}

public class NTTRunService : INTTRunService
{
    //OTHER METHODS HERE

    /// <summary>
    /// Return a wind station by id
    /// </summary>
    /// <exception cref="System.Exception">Catch all exception</exception>
    /// <returns></returns>
    public JsonReturnObject GetWindStationById(int id)
    {
        try
        {
            return new JsonReturnObject
            {
                ObjectPayload = DB.d_wind_weather_station
                                    .SingleOrDefault(w => w.windStationId == id)
            };
        }
        catch (Exception e)
        {
            log.FatalFormat("GetWindStationById - Unable to get wind station for id {0}. Exception: {1}", id, e);
            throw;
        }
    }

    /// <summary>
    /// Return a weather station by id
    /// </summary>
    /// <exception cref="System.Exception">Catch all exception</exception>
    /// <returns></returns>
    public JsonReturnObject GetWeatherStationById(int id)
    {
        try
        {
            return new JsonReturnObject
            {
                ObjectPayload = DB.d_weather_station
                                    .SingleOrDefault(w => w.weatherStationId == id)
            };
        }
        catch (Exception e)
        {
            log.FatalFormat("GetWeatherStationById - Unable to get weather station for id {0}. Exception: {1}", id, e);
            throw;
        }
    }
}

0 个答案:

没有答案