Windows Azure上出现CS0101错误

时间:2013-02-18 14:58:09

标签: c# .net azure

我一直在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;
        }
    }
}

谢谢,

弗雷迪

0 个答案:

没有答案