我正在尝试向WCF服务添加两个新方法。当我通过Visual Studio运行服务时,新方法不会出现在WSDL中。我之前已经为这项服务添加了服务方法,所以我不知道为什么这次我看不到新的方法。
我试过(没有特别的顺序)......
以上都没有显示新方法
因为复制到新的解决方案我得出结论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;
}
}
}