3

jquery から WCF Ria サービスを使用して作成された DomainService を呼び出そうとしています。POST を使用すると、405 メソッドは許可されません。Get を使用すると、javascript エラーが発生します。設定手順がありませんか? このコードは 405 になります。

    function GetSearchResults() {
        $.ajax(
    {
        type: "POST",
        url: "/Services/CustomerService.svc/GetCustomerSearchResults",
        data: '{"customerId":1}',
        timeout: 5000,
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: Success,
        error: Fail
    });
    }

[EnableClientAccess]
public class CustomerService : DomainService
{
    public List<CustomerSearchResult> GetCustomerSearchResults(string customerId)
    {


        var list = new List<CustomerSearchResult>();
        list.Add(new CustomerSearchResult
            {
              Id = 1,
                                   Name = "Me"
            });
        }

        return list;
    }

}

4

0 に答える 0