「メソッドは許可されていません」というメッセージが表示されます。GET 操作を呼び出すときに WCF サービスからエラーが発生しました。なぜこれが起こっているのかはわかっていますが、なぜ許可されていないのか理解できません。私は何か間違ったことをしているかもしれないと思います。GET と POST に同じ UriTemplate (属性) 構造を使用しようとしています。私は標準の REST サービス規則に従っています。
GET - /api/v1/{entityType} - to get a list of {entityType} e.g. /api/v1/cars
POST - /api/v1/{entityType} - to insert an entity e.g /api/v1/car
[OperationContract]
[WebGet(BodyStyle = WebMessageBodyStyle.Bare,
ResponseFormat = WebMessageFormat.Json,
UriTemplate = "api/v1/{entityType}?skip={skip}&take={take}")]
List<Entity> GetEntityList(string entityType, int skip, int take);
[OperationContract]
[WebInvoke(Method = "POST",
BodyStyle = WebMessageBodyStyle.Bare,
ResponseFormat = WebMessageFormat.Json,
RequestFormat = WebMessageFormat.Json,
UriTemplate = "api/v1/{entityType}")]
Entity InsertEntity(string entityType, Entity entity);
私の UriTemplates が同じであることは理解していますが、なぜこれが許可されていないのですか? サーバーは、実行しようとしている操作を検出しませんか?