asp.net mvc 中使用ashx文件时出现错误

在作asp.net mvc的项目时,用到了ajax,本人习惯用ashx(通常处理程序)处理数据,在进行编译的时候出现了如下错误:ajax

错误1:命名空间不能直接包含字段或方法之类的成员mvc

错误2:原义说明符 @ 以后应为关键字、标识符或字符串asp.net

wKiom1L7HA7DeqTuAAC6flstOEU645.jpg

英文释义为:ide

error 1: A namespace cannot directly contain members such as fields or methods测试

error 2: Keyword, identifier, or string expected after verbatim specifier: @ui

搜索了好久,终于在stackflow上找到了一个答案,英文原文是:spa

I figured it out... The ashx file itself was set to compile, changed it to content and compile only the cs file and it builds...net

英文不是很难,就是说把ashx文件的属性改成“内容”,ashx.cs文件的属性改成“编译便可”,测试以后一切能够正常使用。blog

相关文章
相关标签/搜索