Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Webpart on the home page broken but does not appeared to be broken all the time. So I need to find out which WFE webpart is broken? Load balance is in place with 2 WFE.

or is not the WFE since webparts are stored in the content database?

Any suggestion?

share|improve this question
    
What web part is broken? It might have inconsistency in what it does. –  James Love Oct 13 '11 at 14:54
add comment

8 Answers 8

up vote 5 down vote accepted

I found interesting article about this issue here http://geekswithblogs.net/kjones/archive/2010/10/29/142510.aspx

Author created a small graphic files, copied them to C:\Program Files\Common Files\Microsoft Shared\web server extensions\1x\TEMPLATE\IMAGES and insert them to page footer. Because every WFE look to their own images directory, he can simply recognize by looking on the image which WFE served the page without any effort. He wrote about images only 3 pixels wide, I created something bigger that fits to our brand style and who does not know about it, don't notice it. Of course, if you want to display more information, it is not the right way, but for simply recognizing the server it is enough, You can even find that information from any users computer. This can be handy.

or you can stop one WFE for a while, test your web part, run him again and vice versa...

share|improve this answer
    
Please dont just link to external content, instead briefly describe what the article say, and en link (links tend to die) –  Anders Rask Oct 18 '11 at 6:03
    
I'm sorry, corrected. –  Molik Oct 19 '11 at 10:23
add comment

You should be able to see a ULS log entry on the WFE that is serving the request. It will only appear on one of the WFE's. It might also reveal other information about what's going on with the web part.

The defauly location of the ULS logs is here: C:\Program Files\Common Files\Microsoft Shared\Web server extensions\12\LOGS

Check out the ULS Log Viewer (free download), it's much nicer than weeding through the text file.

share|improve this answer
add comment

I've got a neat little web part that you can throw on your server. It'll show you the current server name, perfect for this issue. See http://sp2010adminpack.codeplex.com/

share|improve this answer
    
+1 for a nice toolset –  Anders Rask Oct 18 '11 at 6:04
    
While a neat tool, it won't help if there's an error related to that and all you get is a generic error with no webparts... –  tekiegreg Oct 19 '11 at 21:40
    
true @tekiegreg, however the statement "does not appeared to be broken all the time" would indicate that they could run it and know what server they're on before/after the break. Also, if it's unique pages breaking, then load this up on another page –  David Lozzi Oct 20 '11 at 12:56
add comment

If it's displaying error messages you should have a correlation ID, likely that correlation ID will only match in one WFE's log (unless both are somehow working in tandem to produce the problem, be mindful of this depending on your web part), you'll just have to figure out which one.

Other than that, you could try setting up alternate URL's that don't go through the Load Balancer(s) to help out. Re-jigger your infrastructure a bit and that should work.

share|improve this answer
add comment

An iehttpheader can be installed for internet explorer and you will start receiving details like in this picture - http://www.blunck.info/screenshots/iehttpheaders_screenshot.jpg

Once you add a WFE tag with server name as value in your web.config file for all the WFEs, you start receiving the WFE name in the iehttpheader browser. This is quite easy and simple.

share|improve this answer
add comment

I do this through an httpmodule which adds some text at the end of the page. So all I do is hit view source and I can see which WFE i'm on. I also display the page server side load time for some other end user experience tracking tools I have.

public class ServerNameAndLoadTime : IHttpModule
{
    //Taken from:  http://blog.dotnetclr.com/archive/2009/07/24/508.aspx
    private string _doNotShowPaths = ConfigurationManager.AppSettings["ServerNameAndLoadTime_DoNotShowPaths"];

    public void Init(System.Web.HttpApplication context)
    {
        context.BeginRequest += new EventHandler(context_BeginRequest);
        context.EndRequest += new EventHandler(context_EndRequest);
    }

    bool IsReady(System.Web.HttpContext ctx)
    {
        if (false == ctx.Response.ContentType.Equals("text/html")) return false;
        if (ctx.Request.RequestType == "POST") return false;

        string url = ctx.Request.Url.ToString();

        string[] doNotShow = null;
        if (_doNotShowPaths.Length > 0)
        {
            doNotShow = _doNotShowPaths.Split(',');
            foreach (string doNotShowUrl in doNotShow)
            {
                if (doNotShowUrl.Length > 0 &&
                    url.ToLower().Contains(doNotShowUrl.ToLower()))
                {
                    return false;
                }
            }
        }

        return true;
    }

    void context_BeginRequest(object sender, EventArgs e)
    {
        using (new SPMonitoredScope("ServerNameAndLoadTime Begin"))
        {
            try
            {
                HttpApplication app = sender as HttpApplication;
                if (app == null) return;

                if (IsReady(app.Context))
                {
                    Stopwatch sw = new Stopwatch();
                    app.Context.Items.Add("PageLoadTimeStopWatch", sw);
                    sw.Start();
                }
            }
            catch { }
        }
    }

    void context_EndRequest(object sender, EventArgs e)
    {
        using (new SPMonitoredScope("ServerNameAndLoadTime End"))
        {
            try
            {
                HttpApplication app = sender as HttpApplication;
                if (app == null) return;

                Page page = app.Context.CurrentHandler as Page;
                if (page == null) return;

                if (IsReady(app.Context))
                {

                    // stop the watch
                    Stopwatch sw = (Stopwatch)app.Context.Items["PageLoadTimeStopWatch"];
                    sw.Stop();

                    app.Context.Response.Write("\n<!-- Server: " + app.Server.MachineName + " -->\n");
                    app.Context.Response.Write("<!-- Load Time: " + sw.ElapsedMilliseconds + " -->");

                }
            }
            catch { }
        }
    }

    public void Dispose()
    {
    }

}
share|improve this answer
add comment

Try this solution I just posted: http://spservername.codeplex.com

share|improve this answer
    
While this may theoretically answer the question, we prefer inclusion of the essential parts of the answer here, and to provide the link for reference. See answer for general guidelines. [moderator] –  SPDoctor Jan 23 '13 at 8:29
add comment

Here is the link of the free webpart that shows the wfe. you can get the server name you are hitting.

http://www.sharepointsecurity.com/sharepoint/sharepoint-development/free-server-name-webpart-which-wfe-is-servicing-a-sharepoint-request/

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.