问题
This code:
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());
}
}
produces this error:
The HTTP verb POST used to access path '/Membership/user/' is not allowed
I think it may have something to do with this being incorrect:
public static void InitializeService(IDataServiceConfiguration config)
{
config.SetEntitySetAccessRule("*", EntitySetRights.All);
config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);
}
Or it may have something to do with the ASP.NET configuration, but I am not sure what to do in there.
I am trying to use Silverlight, DataEntityFramework, and a WCF Service all together (for the first time) and have no idea where exactly the solution to this problem lies.
回答1:
I got a similar problem, it seems that there are problems with the url rewriting.
http://www.lukemelia.com/blog/archives/2007/01/05/aspnet-the-http-verb-post-used-to-access-path-is-not-allowed/
You have to remove the mapping of ‘*’ to aspnet_isapi.dll in yourIIS settings.
来源:https://stackoverflow.com/questions/758780/the-http-verb-post-used-to-access-path-membership-user-is-not-allowed