【发布时间】:2013-11-13 11:42:30
【问题描述】:
我在 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
类分类信息
*错误:
'D:\ProjectName\Project Path\bin\ProjectName.dll' 和 C:\Windows\Microsoft.NET\Framework\v4.0.30309\Temporary ASP.NET Files\root\1664c01d_shadow\b956618\414288438\30335072\App_Code.j4b-_1mm.dll*
有什么办法可以解决这个问题吗?
【问题讨论】:
-
我没有在目录中放置任何 dll。它自动生成的@CodeCaster
-
我认为这个问题与您的问题非常相似。单击链接,验证问题,检查所有答案是否适用,然后然后您可以告诉我我链接到了错误的答案。目前,您似乎可以尝试其中的一些答案来解决您的问题。我确实认为@Darin 对 App_Code 目录有一点看法。
标签: c# asp.net asp.net-mvc wcf asp.net-mvc-4