我有以下問題:的WebMethod不叫(觸發)通過PageMethod的在Visual Studio 2013
從一個WebMethod,電話不被上在Visual Studio 2013(ASP.NET Web窗體應用程序)創建的項目來完成。例如,如果我創建了一個項目,在Visual Studio 2008中遷移到VS 2013可以正常工作。只有在Visual Studio 2013中創建新項目時纔會出現此問題。控制檯中沒有錯誤消息。 WebMethod只是沒有被調用。什麼都沒發生。我搜查了很多,但一無所獲。
ASPX代碼:
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="TestePageMethods._Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" EnablePageMethods="true" runat="server" />
<script type="text/javascript">
function testeClick() {
PageMethods.SayHello("Name");
}
</script>
<input type="button" value="Say Hello" onclick="testeClick();" />
</form>
</body>
</html>
ASPX.VB代碼:
Partial Public Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
<System.Web.Services.WebMethod(True)> _
Public Shared Function SayHello(ByVal name As String) As String
Return "Hello " & name
End Function
End Class
有沒有人嘗試過這種或知道解決辦法嗎?我不知道該怎麼辦...
編輯:
夥計們,我發現現在多了一個信息:
只在VS2013工作:
- 新項目。網頁 - ASP.NET Web應用程序。 - 選擇模板「空」。 - 插入頁面「的Default.aspx」,將WebMethod正常工作......
現在,如果你創建一個新的項目,並選擇模板「的WebForms」,不工作...
可以是交叉引用?或一些不同的設置?
Vocêvai querer dar uma olhada nesse site paraPortuguês:http://br.stackoverflow.com/ –
問題需要用英語。 – thewaywewalk
謝謝,我會問那裏的問題.. –