溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

asp.net mvc 中使用ashx文件時(shí)出現(xiàn)錯(cuò)誤

發(fā)布時(shí)間:2020-04-06 00:01:44 來源:網(wǎng)絡(luò) 閱讀:2403 作者:poSAM 欄目:編程語言

在做asp.net mvc的項(xiàng)目時(shí),用到了ajax,本人習(xí)慣用ashx(一般處理程序)處理數(shù)據(jù),在進(jìn)行編譯的時(shí)候出現(xiàn)了以下錯(cuò)誤:

錯(cuò)誤1:命名空間不能直接包含字段或方法之類的成員

錯(cuò)誤2:原義說明符 @ 之后應(yīng)為關(guān)鍵字、標(biāo)識(shí)符或字符串

asp.net mvc 中使用ashx文件時(shí)出現(xiàn)錯(cuò)誤

英文釋義為:

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

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

搜索了很久,終于在stackflow上找到了一個(gè)答案,英文原文是:

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

英文不是很難,就是說把a(bǔ)shx文件的屬性改為“內(nèi)容”,ashx.cs文件的屬性改為“編譯即可”,測試之后一切可以正常使用。

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI