我在 WCF 应用程序中返回一个类文件。从 wsdl(WCF 应用程序)的 svcutil.exe 生成的类文件 AuthenticationService.cs 保存在 App_Code 中并在我的项目中使用。
public ActionResult ViewName()
{
AuthenicationServiceClient client = new AuthenicationServiceClient("BasicHttpBinding_IAuthenicationService");
IList<CategoryInfo> category = new List<CategoryInfo>();
category = client.GetCategories(0, true);
return View(category);
}
CategoryInfo 类存在于 AuthenticationService.cs 中,我可以从控制器访问它,但不能在视图中使用它。当我在视图中使用相同的 CategoryInfo 时,它显示错误消息
In View
@model CategoryInfo
类 CategoryInfo
*错误:
“D:\ProjectName\Project Path\bin\ProjectName.dll”和 C:\Windows\Microsoft.NET\Framework\v4.0.30309\Temporary ASP.NET Files\root\1664c01d_shadow 中都存在“CategoryInfo”类型\b956618\414288438\30335072\App_Code.j4b-_1mm.dll*
有没有办法克服这个问题?