我在具有 CSLA 的分布式环境中使用 MVC .NET,并且我可以从我的一个 Web 层(例如 Website.MVC)引用 HttpPostedFileBase,但我不能从单独的层引用 HttpPostedFileBase(我们称之为 OtherLayer.Web).
I am using MVC .NET in a distributed environment with CSLA and I can reference HttpPostedFileBase from one of my web layers (eg Website.MVC), but I cannot reference HttpPostedFileBase from a separate layer (lets call it OtherLayer.Web).
知道我需要做什么才能调用 HttpPostedFileBase 吗?我可以在两个层中使用 HttpPostedFile - 我应该只使用它吗?
Any idea on what I need to do to be able to call HttpPostedFileBase ? I am able to use HttpPostedFile in both layers - should I just use this instead?
程序集引用基本相同 - 在 Website.MVC 我有:
The assembly references are basically the same - in Website.MVC I have:
namespace Website.Mvc.Controllers
{
using System;
using System.Collections;
using System.Collections.Generic;
using System.Web.Mvc;
using System.Web;
using System.IO;
using PetOrganizer.Mvc.Helpers;
using TrupanionPetInsurance.Web;
而在我的另一层中,我有:
Whereas in my other layer i have:
namespace OtherLayer.Web
{
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Net.Mail;
using System.Text;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.Mvc;
using System.Web.Security;
using System.Xml;
using System.Xml.Serialization;
using Csla;
using iTextSharp.text;
using iTextSharp.text.pdf;
using TruDat.BusinessLayer;
using TruDat.BusinessLayer.Billing;
using TruDat.BusinessLayer.Data;
using TruDat.BusinessLayer.Utility;
using TrupanionPetInsurance.Web.EmailTemplateParser;
using TruDat.BusinessLayer.DataServices;
确保您的项目引用了 System.Web.Abstractions
程序集,其中包含 HttpPostedFileBase
类型.
Make sure your project references the System.Web.Abstractions
assembly which contains the HttpPostedFileBase
type.
虽然看起来很混乱,但 HttpPostedFile
类型位于单独的程序集 (System.Web
) 中,但具有完全相同的命名空间.
As confusing as it may seem, the HttpPostedFile
type lives in a separate assembly (System.Web
) but the same exact namespace.
请务必记住,命名空间可以跨越程序集,并且程序集的名称不一定指示其中包含的类型的命名空间.没有 System.Web.Abstractions
namespace 只是两个包含 System.Web
命名空间中的类型的程序集.
It is important to remember that the namespaces can span assemblies and the name of an assembly does not necessarily dictate the namespace of the types contained in it. There is no System.Web.Abstractions
namespace simply two assemblies that contain types in the System.Web
namespace.
一旦你引用了这两个程序集,你就可以使用这个单一的 using 语句通过它们的非限定名称来引用这两种类型:
Once you have referenced both assemblies you can reference both types by their unqualified names with this single using statement:
using System.Web;
这篇关于C# - 我无法引用 HttpPostedFileBase的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!