WCF Configuration Hell?

前端 未结 7 1167
一生所求
一生所求 2021-02-08 01:07

I hate WCF setup with endpoints, behaviors etc. I believe all these things should be performed automatically. All I want to do is to return JSON result from my WCF service. Here

7条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-08 01:38

    You are using the WebInvokeAttribute which tells WCF by default to accept POST as the verb. Since you are trying to access it via a GET action, it is being ignored.

    Use WebGetAttribute instead.

    Per MSDN:

    If you want a service operation to respond to GET, use the WebGetAttribute instead.

提交回复
热议问题