2017-10-10 45 views
-2

我收到此錯誤:錯誤43類型或命名空間名稱ViewAsPdf'不存在命名空間「Rotativa」存在(是否缺少程序集引用?)

Error 40 The type or namespace name 'ViewAsPdf' does not exist in the namespace 'Rotativa' (are you missing an assembly reference?) D:\SandeepPatil\PPD_Projects\Code\Karma_Retail\Karma.Store\Areas\Admin\Controllers\OrderController.cs 1757 45 Karma.Retail.Web

enter image description here

+1

*該類型是否應該存在?你爲什麼會這樣想? – David

+0

錯誤sir Asp net Mvc如何解決。 –

+3

您有兩個選擇來「解決」「錯誤」:(1)包含您嘗試使用的庫。或者(2)不要嘗試使用不存在的類型。 – David

回答

0

This error是由於試圖實例化一個Rotativa.ViewAsPdf對象而引起的,我相當肯定它不是一個對象,而是類Rotativa的靜態方法。

從周圍的代碼我可以在你的截圖看,我可以假設ViewAsPdf返回一個字節數組的方法,在這種情況下,最簡單的解決辦法是在它的前面取出new,其中在這種情況下,供應絕對沒有。

請注意,此答案僅基於假設,因爲您的屏幕截圖提供的信息量較少。您可能希望在問題中發佈您的代碼,以便我們更好地理解上下文。

相關問題