You must Sign In to post a response.
  • Category: ASP.NET

    Web.sitemap error - "The process cannot load /inetpub/wwwroot/web.sitemap because its being used by

    I get this error when i deploy and run asp .net application in 2 load balance server. The error message is "The process cannot load /inetpub/wwwroot/web.sitemap because its being used by another process". What is the problem actually? Is it at the server or at my coding.?..Please help anyone. Reminder again..i'm using 2 load balance server. TQ so much.

    My code are as below:.

    Response.ContentType = "text/xml";

    using (XmlTextWriter writer = new XmlTextWriter(Server.MapPath("Web.sitemap"), Encoding.UTF8))
    {
    writer.WriteStartDocument();
    writer.WriteRaw("\n");
    writer.WriteStartElement("siteMap");
    writer.WriteAttributeString("xmlns", "http://schemas.microsoft.com/AspNet/SiteMap-File-1.0");

    writer.WriteRaw("\n");
    writer.WriteRaw("\t");
    writer.WriteStartElement("siteMapNode");
    writer.WriteAttributeString("url", "~/Home.aspx");
    writer.WriteAttributeString("title", "Home");
    writer.WriteRaw("\n");
    writer.WriteRaw("\t\t");
    writer.WriteStartElement("siteMapNode");
    writer.WriteAttributeString("url", "~/MainPage/main.aspx?system=" + lblsystemID.Text);
    writer.WriteAttributeString("title", lblProfile.Text);
    using (SqlConnection con = ClassConn.GetPortalCon())
    {

    SqlCommand cmd = new SqlCommand("ret_Menu", con);
    cmd.CommandType = CommandType.StoredProcedure;
    cmd.Parameters.AddWithValue("@userID", nopkj);
    cmd.Parameters.AddWithValue("@systemID", lblsystemID.Text);

    SqlDataReader sc = cmd.ExecuteReader();

    if (sc.HasRows)
    {
    while (sc.Read())
    {

    var menuID = sc["menuID"].ToString();

    writer.WriteRaw("\n"); writer.WriteRaw("\t\t\t");
    writer.WriteStartElement("siteMapNode");
    writer.WriteAttributeString("url", sc["menuPath"].ToString());

    writer.WriteAttributeString("title", sc["menuDesc_bi"].ToString());

    writer.WriteAttributeString("menuID", sc["menuID"].ToString());

    using (SqlConnection con1 = ClassConn.GetPortalCon())
    {

    SqlCommand cmd1 = new SqlCommand("ret_SubMenuSiteMap", con1);
    cmd1.CommandType = CommandType.StoredProcedure;
    cmd1.Parameters.AddWithValue("@userID", nopkj);
    cmd1.Parameters.AddWithValue("@systemID", lblsystemID.Text);
    cmd1.Parameters.AddWithValue("@menuID", menuID);

    SqlDataReader sc1 = cmd1.ExecuteReader();

    if (sc1.HasRows)
    {
    while (sc1.Read())
    {
    string menuPath = sc1["subMenuPath"].ToString();


    writer.WriteRaw("\n");
    writer.WriteRaw("\t\t\t\t");
    writer.WriteStartElement("siteMapNode");

    writer.WriteAttributeString("title", sc1["subMenuDesc_bi"].ToString());
    writer.WriteAttributeString("description", sc1["subMenuDesc_bi"].ToString());

    writer.WriteEndElement();
    }
    }
    sc1.Close();
    sc1.Dispose();
    con1.Close();
    con1.Dispose();

    }
    writer.WriteEndElement();
    writer.Flush();

    }
    }
    sc.Close();
    sc.Dispose();
    con.Close();
    con.Dispose();
    }

    writer.WriteFullEndElement();
    writer.WriteEndDocument();
    writer.Flush();
    writer.Close();

    }
  • #769700
    This is because request sharing between servers in load balancing within the same session.
    you can check load balancing settings how they have configured when for asp.net request, especially session stickyness . are you using CookieInsert or SourceIP?

    we have several approaches and Round Robin methods to maintain same session for different requests comming from the same client. if this is not configured then you requests will jump into other server and cause issue when sharing common resource like above.

    so, persistence settings are important when you configure load balancing in web farm approach.

    Thanks!
    B.Ramana Reddy


  • Sign In to post your comments