0

我试图在我的 Web 应用程序的公共类中调用公共函数,但由于某种原因,即使我可以正常访问该类并且该函数被标记为公共,该函数也无法访问。当我打电话时FileUploader,我得到的唯一选项是 equals 和 referenceanceequals。我在看什么愚蠢的东西?请注意,该课程位于我的应用程序中名为 Classes 的辅助项目中。我在访问项目中的差异类时没有问题FileUploader

using System;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Auth;
using Microsoft.WindowsAzure.Storage.Blob;
using Microsoft.WindowsAzure;
using System.IO;
using System.Configuration;
using FFInfo.Classes;

namespace FFInfo
{
    public partial class FUTest : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            if (fuFile.HasFile)
            {

            }
        }
    }
}

文件上传器.cs

    using FFInfo.DAL;
using FFInfo.DAL.Tables;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Blob;
using System;
using System.Web;

namespace FFInfo.Classes
{
    public class FileUploader
    {
        public Int64 UploadSiteImage(string ConnectionString, string ContainerName, string FilePath, HttpPostedFile UploadedFile)
        {
            CloudStorageAccount SiteImages = CloudStorageAccount.Parse(ConnectionString);
            CloudBlobClient SiteImagesBlob = SiteImages.CreateCloudBlobClient();
            CloudBlobContainer SiteImageContainer = SiteImagesBlob.GetContainerReference(ContainerName);
            SiteImageContainer.CreateIfNotExists();
            CloudBlockBlob Image = SiteImageContainer.GetBlockBlobReference(FilePath + UploadedFile.FileName);

            using (UploadedFile.InputStream)
            {
                Image.UploadFromStream(UploadedFile.InputStream);
            }

            using (var db = new Compleate())
            {
                File NewFile = new File()
                {
                    ContainerName = ContainerName,
                    FilePath = FilePath,
                    FileName = UploadedFile.FileName,
                    ContentType = UploadedFile.ContentType
                };

                db.Files.Add(NewFile);
                db.SaveChanges();
                return NewFile.FileID;
            }
        }
    }
}
4

2 回答 2

1

您的意思是说该UploadSiteImage方法是静态的吗?

于 2013-03-12T23:06:42.820 回答
0

试试(新的 FileUploader())。<-- 将在这里获得智能感知。

但是,是的,您可能希望该方法是公共静态的

于 2013-03-12T23:18:42.320 回答