尚未引用此标签。警告消息将停止发布

时间:2019-04-23 06:49:34

标签: asp.net web-services c#-4.0

我已经为某些响应创建了一些Web API。编译良好,并在Visual Studio localhost上运行。我刚刚发布它的方式却给了我这样的错误:

 Warning    15  This label has not been referenced  C:\MSSMS.infisms.co.in\MSSMS.infisms.co.in\App_Code\BulkSMS.cs  578 5   C:\MSSMS.infisms.co.in\MSSMS.infisms.co.in\

这是我的服务代码:

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
[System.Web.Script.Services.ScriptService]
public class BulkSMS : System.Web.Services.WebService
{
    public BulkSMS()
    {
        //Uncomment the following line if using designed components 
        //InitializeComponent();         
    }

    #region Sendmessage

    public string SendQuickMessage(string C_Name, string MobileNo, string Message, int AccountType, int Sender, int MessageType)
    {
        string Response = " ";// string.Empty;
        try
        {
            int CharCount = CharMsgCount(Message, MessageType);
            string[] Mobilenos = MobileNo.Split(',');

            foreach (string Mobile in Mobilenos)
            {
                AppGlobal.Message message = new AppGlobal.Message();
                message.intUserID = SiteUser.Current().UserID;
                message.strC_Name = C_Name;
                message.strMobileNo = Mobile;
                message.strMessageText = Message;
                message.intAccounttype = AccountType;
                message.intSenderID = Sender;
                message.intMessagetype = MessageType;
                message.dtReceiveTime = DateTime.Now;
                message.intCharCount = CharCount;

                AppGlobal.Messagequeuq.Enqueue(message);

                //Mysql.ExecuteNonQuery("BulkSMS_SendQuickMessage", SiteUser.Current().UserID, C_Name, Mobile, Message, AccountType, Sender, MessageType);
            }
            //Mysql.ExecuteNonQuery("BulkSMS_AddArchiveMessgae", SiteUser.Current().UserID, Message);

            Response = "Success";
        }
        catch (Exception ex)
        {
            Response = "Error in BulkSMS_SendQuickMessage : " + MobileNo + "  " + CommonMethods.GetErrorMessage(ex, "BulkSMS_AddArchiveMessgae");
        }
    **RESPONSE:// this line gives warning message not referenced label**
        if (!string.IsNullOrWhiteSpace(Response))
            AppGlobal.Logger.WriteToErrorLogFile(Response);
        return Response;
    }

请帮我摆脱这些家伙...

1 个答案:

答案 0 :(得分:0)

原因表明“未引用标签”。您必须按照以下说明在goto语句中使用创建的标签

Response: // you have created a label with name "Response".
{
   //your for loop is executed inside your label block.
}
goto Response;

添加goto Response语句将禁用该警告。