0
我試圖測試與我的WebCache REST服務屬性WCF REST - 如何測試的WebCache
[ServiceContract]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public partial class MyContract : IMyContract
{
[OperationContract()]
[WebGet(ResponseFormat = WebMessageFormat.Json, UriTemplate = "items/{code}"
[WebCache(CacheProfileName = "NoCacheProfile")]
public ItemDTO GetItem(string code)
當我嘗試打開主機
WebServiceHost host = new WebServiceHost2(typeof(MyContract), true, new Uri("http://localhost:7777/MySvc"));
host.Open();
我得到下面的異常
[System.NotSupportedException] = {「WebCacheAttribute僅在AspNetCompatibility模式下受支持。」}