【问题标题】:The HTTP verb POST used to access path '/Membership/user/' is not allowed不允许使用 HTTP 动词 POST 访问路径“/Membership/user/”
【发布时间】:2009-04-17 02:36:56
【问题描述】:

这段代码:

private void Submit_Click(object sender, RoutedEventArgs e)
{
 user temp = new user();
 temp.Username = UserName.Text;
 temp.Password = Password.Text;
 dataBase.AddTouser(temp);
 IAsyncResult result = dataBase.BeginSaveChanges(new AsyncCallback (OnSaveChangesCompleted), temp); 
}

void OnSaveChangesCompleted(IAsyncResult result)
{
 try
 {   
    string name = ((user) result.AsyncState).Username.ToString();
    dataBase.EndSaveChanges(result);
 }
 catch (DataServiceRequestException ex)
 {
     MessageBox.Show("OnSaveChangesCompleted Error: " + ex.ToString());
 }
}

产生这个错误:

不允许使用 HTTP 动词 POST 访问路径“/Membership/user/”

我认为这可能与此错误有关:

public static void InitializeService(IDataServiceConfiguration config)
{
 config.SetEntitySetAccessRule("*", EntitySetRights.All);
 config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);
}

或者它可能与 ASP.NET 配置有关,但我不确定在那里做什么。

我正在尝试同时使用 Silverlight、DataEntityFramework 和 WCF 服务(这是第一次),但不知道该问题的解决方案究竟在哪里。

【问题讨论】:

  • 请格式化您的代码以便人们阅读。

标签: wcf silverlight entity-framework


【解决方案1】:

我也遇到了类似的问题,好像是url重写有问题。

http://www.lukemelia.com/blog/archives/2007/01/05/aspnet-the-http-verb-post-used-to-access-path-is-not-allowed/

您必须在 IIS 设置中删除“*”到 aspnet_isapi.dll 的映射。

【讨论】:

    猜你喜欢
    • 2011-07-11
    • 1970-01-01
    • 1970-01-01
    • 2011-12-21
    • 2011-06-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多