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

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

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

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

英文释义为:

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

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

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

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..

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

本文出自 “霏云霏雨” 博客,请务必保留此出处http://laughingsir.blog.51cto.com/2710578/1358433

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。