ajaxpro ajaxMethod Error:

今天项目开发过程中,偶然发现了ajaxpro报错 This method is either not marked with an AjaxMethod or is not availab

在google了半天后,终于发现一个解决方案

 

How to prevent System.NotSupportedException: This method is either not marked with an AjaxMethod or is not available
在曾在谷歌有关System.NotSupportedException一批又改变App_Code文件夹中的文件进行讨论。 The was a discussion at the Google group about the System.NotSupportedException after changing files in App_Code folder. 由于没有固定的App_Code文件夹,将在每一个“重建”一个新名称,将看起来很奇怪的生成assmebly名称。 As there is no static assmebly name for the App_Code folder it will generated on each "rebuild" a new name that will look like very strange. 该程序集的名称是用于任何AjaxPro的呼吁,这将是一个问题,在不久之后的JavaScript包装发送给客户端的名称更改。 The name of the assembly is used for any AjaxPro call and this will be a problem when the name changes after sending the JavaScript wrapper to the client.
为了避免这种情况有一个Web.config中指定类型映射选项。 To prevent this there is an option in web.config to specify type mappings. 见下面的例子: See the example below:
    <ajaxNet> <ajaxNet>
    <ajaxSettings> <ajaxSettings>
    <urlNamespaceMappings> <urlNamespaceMappings>
    <添加type=" Namespace.Classname,AssemblyName“path=" mypath中 "/> <add type=" Namespace.Classname,AssemblyName " path=" mypath "/>
    “/ urlNamespaceMappings” </urlNamespaceMappings>
    “/ ajaxSettings” </ajaxSettings>
    “/ ajaxNet” </ajaxNet>
如果你现在使用的App_Code文件夹中,您可以使用您的程序集名称App_Code文件的方法: If you are now using methods in your App_Code folder you can use App_Code as your assembly name:
    <ajaxNet> <ajaxNet>
    <ajaxSettings> <ajaxSettings>
    <urlNamespaceMappings> <urlNamespaceMappings>
    <添加type=" Namespace.Classname,App_Code“path=" mypath中 "/> <add type=" Namespace.Classname,App_Code " path=" mypath "/>
    “/ urlNamespaceMappings” </urlNamespaceMappings>
    “/ ajaxSettings” </ajaxSettings>
    “/ ajaxNet” </ajaxNet>
这将迫使AjaxPro使用短名称每次而不是默认的程序集名称的变化。 This will force AjaxPro to use the short name everytime instead of the changing assembly name by default.

posted @ 2009-12-16 14:39  Amos_li  阅读(1049)  评论(2编辑  收藏  举报
Chat with underwing Li