WebMethod is not called (called) by PageMethod in Visual Studio 2013

I have the following problem:

A call from WebMethod is not performed in a project created in Visual Studio 2013 (ASP.NET WebForms application). If I create a project, for example, in Visual Studio 2008 and switch to VS 2013, we work correctly. The problem only occurs when creating a new project in Visual Studio 2013. There is no error message in the console. WebMethod is simply not called. Nothing happened. I searched a lot, but found nothing about it.

ASPX Code:

<%@ 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 Code:

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

Has anyone tried this or knew about a solution? I do not know what to do...

EDIT:

Guys, I discovered one more information:

Work only in VS2013:

- . -Web - - ASP.NET. - "". - "Default.aspx", WebMethod ...

, "WebForms", ...

? ?

+4
1

: , WebMethod, "System.Web.Optimization". , , , :

"System.Web.Optimization" "Microsoft.AspNet.Web.Optimization.WebForms"

web.config :

<namespaces>
    <add namespace="System.Web.Optimization" />
</namespaces>

<add assembly="Microsoft.AspNet.Web.Optimization.WebForms" 

namespace="Microsoft.AspNet.Web.Optimization.WebForms" tagPrefix="webopt" />

<dependentAssembly>
        <assemblyIdentity name="WebGrease" culture="neutral" 

publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
      </dependentAssembly>

! , !:)

+3

All Articles