0

我一直在 Windows Azure 中的 .NET 站点上工作。昨晚我进行了部署并开始收到以下错误:

Server Error in '/' Application.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. 
Compiler Error Message: CS0101: The namespace 'Avviato.PVSA.Objects' already contains a definition for 'LogProccess'

Source Error:
    Line 13: namespace Avviato.PVSA.Objects
    Line 14: {
    Line 15:     public class LogProccess
    Line 16:     {
    Line 17:         public long logId { get; set; }
>Source File: c:\DWASFiles\sites\pvsadev\VirtualDirectory0>\site\wwwroot\App_Code\Objects\LogProcess.cs    Line: 15 

我做了一些研究,根据 MSDN,当您对所涉及的类有多个声明时会触发此错误。但是,我浏览了我的代码,并且该类没有第二个声明LogProcess。该项目在本地运行。有人暗示这可能是缓存在 Azure 上的一些编译错误,所以我尝试在 Azure 的新站点上进行部署,一切正常。

所以问题是:是否有任何其他原因可能触发此错误?如果缓存理论是真的,有没有办法清除 Azure 上的编译缓存?

我已经使用 VS2012 中的 Windows Azure SDK 进行了部署。如果它有帮助,这里是生成错误的类的代码:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;
using Avviato.PVSA.Utils;
namespace Avviato.PVSA.Objects
{
    public class LogProccess
    {
        public long logId { get; set; }
        public DateTime createDate { get; set; }
        public GlobalEnums.LogStatus status { get; set; }
        public GlobalEnums.ObjectType objectType { get; set; }
        public string errorMessage { get; set; }
        public GlobalEnums.LogErrorType errorType {get; set;}
        public long localId { get; set; }
        public string externalId { get; set; }
        public string parameters { get; set; }
        public string testAzure { get; set; }
        public LogProccess()
        {
        }
        public bool  Save()
        {
            bool saved = false;
            SqlCommand command = new SqlCommand();
            SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["PVSA_BD_CONNECTION"].ToString());
            try
            {
                connection.Open();
                command.Connection = connection;
                if (this.logId == 0) // actually the story only can be create, not updated
                {
                    command.CommandText = @"INSERT INTO [tblLog] ([createdDate],[status],[typeObject],[errorMessage],[typeError],[localId],[externalId],[parameters])
                                          VALUES(
                                            @createdDate,@status,@typeObject,@errorMessage,@typeError,@localId,@externalId,@parameters
                                           )";

                    command.Parameters.AddWithValue("@createdDate", DateTime.Now);
                    command.Parameters.AddWithValue("@status", this.status);
                    command.Parameters.AddWithValue("@typeObject", this.objectType);
                    command.Parameters.AddWithValue("@errorMessage", (string.IsNullOrEmpty(this.errorMessage)) ? System.Data.SqlTypes.SqlString.Null : this.errorMessage);
                    command.Parameters.AddWithValue("@typeError", this.errorType);
                    command.Parameters.AddWithValue("@localId", this.localId);
                    command.Parameters.AddWithValue("@externalId", (string.IsNullOrEmpty(this.externalId)) ? System.Data.SqlTypes.SqlString.Null : this.externalId);
                    command.Parameters.AddWithValue("@parameters", (string.IsNullOrEmpty(this.parameters)) ? System.Data.SqlTypes.SqlString.Null : this.parameters);
                    command.ExecuteNonQuery();
                }
            }
            catch (SqlException sqlEx)
            {
                Util.LogExceptionWithQuery(sqlEx, "Registering log", command);
            }
            catch (Exception ex)
            {
                Util.LogException(ex, "Registering log");
            }
            finally
            {
                connection.Close();
            }
            return saved;
        }
    }
}
4

0 回答 0