|
|
|
Asp.Net webForms. Почему только Google bot считает сайт недоступным?
|
|||
|---|---|---|---|
|
#18+
Здравствуйте, столкнулся с проблемой. Когда бот Google заходит на сайт, появляется ошибка. Бот google считает сайт недоступным. Вот ошибка HTTP/1.1 500 Internal Server Error Cache-Control: private Content-Type: text/html; charset=utf-8 Server: Microsoft-IIS/7.5 X-AspNet-Version: 4.0.30319 X-Powered-By: ASP.NET Date: Sat, 11 Feb 2012 07:56:20 GMT Content-Length: 4855 Обычный юзер через браузер прекрасно видит весь сайт, авторизуется и т.д. Система: Windows Web Server 2008 R2 (x64) Application pools: ASP.NET 4 - Managed pipeline mode: "Integrated" ISAPI and CGI Restrictions: ASP.NET 4.0.30313 (32-bit): Allowed IIS 7.5 На сервере работает только одна версия asp.net Часть web.config <anonymousIdentification enabled="true" /> <authentication mode="Forms"> <forms cookieless="UseCookies" defaultUrl="Default.aspx" loginUrl="~/AccessDenied.aspx" name="GSFORMAUTH" protection="All" slidingExpiration="true" timeout="44000"> </forms> </authentication> Failed Request tracing log выдает: <?xml version="1.0" encoding="UTF-8" ?> <?xml-stylesheet type='text/xsl' href='freb.xsl'?> <!-- saved from url=(0014)about:internet --> <failedRequest url=" http://mysite.com:80/" siteId="1" appPoolId="ASP.NET v4.0" processId="2956" verb="GET" remoteUserName="" userName="" tokenUserName="IIS APPPOOL\ASP.NET v4.0" authenticationType="anonymous" activityId="{00000000-0000-0000-5700-0080000000F5}" failureReason="STATUS_CODE" statusCode="200" triggerStatusCode="500" timeTaken="4172" xmlns:freb=" http://schemas.microsoft.com/win/2006/06/iis/freb" > Elmah лог вебсайта, ошибка появляется только от ботов: System.NullReferenceException: Object reference not set to an instance of an object. System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.NullReferenceException: Object reference not set to an instance of an object. at Main.Page_Load(Object sender, EventArgs e) at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.HandleError(Exception e) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) at System.Web.UI.Page.ProcessRequest(HttpContext context) at ASP.default_aspx.ProcessRequest(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NullReferenceException: Object reference not set to an instance of an object. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [NullReferenceException: Object reference not set to an instance of an object.] Main.Page_Load(Object sender, EventArgs e) +560 System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35 System.Web.UI.Control.OnLoad(EventArgs e) +91 System.Web.UI.Control.LoadRecursive() +74 System.Web.UI.Control.LoadRecursive() +146 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207 Default.aspx.cs using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.IO; using System.Security; using System.Web.Services; using System.Data.SqlClient; using System.Data; using System.Web.UI.DataVisualization.Charting; using System.Drawing; public partial class Default : ASO.Mercanter.UI.BasePage { protected void Page_Load(object sender, EventArgs e) { // PaletteCustomColors="4295F3,58DB41,F07B69,FFCE7A,A8755E,E387AC" Chart1.Palette = ChartColorPalette.None; Chart1.PaletteCustomColors = new Color[] { Color.FromArgb(66, 149, 243), Color.FromArgb(88, 219, 65), Color.FromArgb(240, 123, 105), Color.FromArgb(255, 206, 122), Color.FromArgb(168, 117, 94), Color.FromArgb(227, 135, 172) }; Chart2.Palette = ChartColorPalette.None; Chart2.PaletteCustomColors = new Color[] { Color.FromArgb(66, 149, 243), Color.FromArgb(88, 219, 65), Color.FromArgb(240, 123, 105), Color.FromArgb(255, 206, 122), Color.FromArgb(168, 117, 94), Color.FromArgb(227, 135, 172) }; if (!Page.IsPostBack) { //chbBusinessman.Checked = true; //chbTrading.Checked = true; using (SqlConnection cn = new SqlConnection(ASO.Mercanter.Globals.Settings.Articles.ConnectionString)) { SqlCommand cmd = new SqlCommand("aso_CompanyProfile_GetCountryPercentage", cn); cn.Open(); int Russia = 0; int Europe = 0; int CIS = 0; int MiddleEast = 0; int Indostan = 0; int EastAsia = 0; int SouthEastAsia = 0; int NorthAmerica = 0; int CentralAmerica = 0; int SouthAmerica = 0; int Caribean = 0; int Australia = 0; int Africa = 0; SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { if ((int)reader["CountryID"] == 2) Russia = (int)reader["CountRec"]; if ((int)reader["CountryID"] == 3) Europe = (int)reader["CountRec"]; if ((int)reader["CountryID"] == 4) CIS = (int)reader["CountRec"]; if ((int)reader["CountryID"] == 5) MiddleEast = (int)reader["CountRec"]; if ((int)reader["CountryID"] == 6) Indostan = (int)reader["CountRec"]; if ((int)reader["CountryID"] == 7) EastAsia = (int)reader["CountRec"]; if ((int)reader["CountryID"] == 8) SouthEastAsia = (int)reader["CountRec"]; if ((int)reader["CountryID"] == 9) NorthAmerica = (int)reader["CountRec"]; if ((int)reader["CountryID"] == 10) CentralAmerica = (int)reader["CountRec"]; if ((int)reader["CountryID"] == 11) SouthAmerica = (int)reader["CountRec"]; if ((int)reader["CountryID"] == 12) Caribean = (int)reader["CountRec"]; if ((int)reader["CountryID"] == 13) Australia = (int)reader["CountRec"]; if ((int)reader["CountryID"] == 14) Africa = (int)reader["CountRec"]; } int all = Russia + Europe + CIS + MiddleEast + Indostan + EastAsia + SouthEastAsia + NorthAmerica + CentralAmerica + SouthAmerica + Caribean + Australia + Africa; if (all > 0) { litPercentRussiaSNG.Text = (((Russia + CIS) * 100) / all).ToString() + "%"; litPercentEurope.Text = (Europe * 100 / all).ToString() + "%"; litPercentAsia.Text = ((EastAsia + SouthEastAsia) * 100 / all).ToString() + "%"; litPercentMiddleEast.Text = (MiddleEast * 100 / all).ToString() + "%"; litPercentIndostan.Text = (Indostan * 100 / all).ToString() + "%"; litPercentNorthAmerica.Text = (NorthAmerica * 100 / all).ToString() + "%"; litPercentSouthAmerica.Text = (SouthAmerica * 100 / all).ToString() + "%"; litPercentCaribean.Text = (Caribean * 100 / all).ToString() + "%"; litPercentAustralia.Text = (Australia * 100 / all).ToString() + "%"; litPercentAfrica.Text = (Africa * 100 / all).ToString() + "%"; } reader.Close(); cn.Close(); } } } protected void lbCool_Click(object sender, EventArgs e) { //ScriptManager.RegisterClientScriptBlock(Page, lbCool.GetType(), "img", "top.document.getElementById('imgLoaded').src='../images/2.jpg';", true); } protected void lbSend_Click(object sender, EventArgs e) { ASO.Mercanter.BLL.References.GuestBook.GuestBookAddComment(txtName.Text, txtText.Text); txtName.Text = ""; txtText.Text = ""; gvGuestBookResults.DataBind(); } protected void lbCheck_Click(object sender, EventArgs e) { int Scope = 0; int Position = 0; if (chbTrading.Checked) Scope = 1; if (chbBuilding.Checked) Scope = 2; if (chbIndustry.Checked) Scope = 3; if (chbFinances.Checked) Scope = 4; if (chbServices.Checked) Scope = 5; if (chbOther.Checked) Scope = 6; if (chbBusinessman.Checked) Position = 1; if (chbBoss.Checked) Position = 2; if (chbManager.Checked) Position = 3; if (chbSpecialist.Checked) Position = 4; if (chbInvestor.Checked) Position = 5; if (chbOtherPosition.Checked) Position = 6; if ((Scope != 0) || (Position != 0)) { using (SqlConnection cn = new SqlConnection(ASO.Mercanter.Globals.Settings.Articles.ConnectionString)) { SqlCommand cmd = new SqlCommand("aso_Polls_CheckMe", cn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@Scope", SqlDbType.Int).Value = Convert.ToInt32(Scope); cmd.Parameters.Add("@Position", SqlDbType.Int).Value = Convert.ToInt32(Position); cmd.Parameters.Add("@UserIP", SqlDbType.NVarChar).Value = Request.UserHostAddress; cn.Open(); int ret = cmd.ExecuteNonQuery(); cn.Close(); } } Chart1.DataBind(); Chart2.DataBind(); ExpirePageCache(); } private void ExpirePageCache() { Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.Cache.SetExpires(DateTime.Now-new TimeSpan(1,0,0)); Response.Cache.SetLastModified(DateTime.Now); Response.Cache.SetAllowResponseInBrowserHistory(false); } } Через плагин смотрел в мозилле на сайт как googlebot 2.1 - все отображает. Не понятно, почему именно с ботами такие сложности. Подскажите пожалуйста, куда копать? Может кто сталкивался с таким. Заранее спасибо. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 14.02.2012, 12:12:54 |
|
||
|
Asp.Net webForms. Почему только Google bot считает сайт недоступным?
|
|||
|---|---|---|---|
|
#18+
alex---, я бы попробовал вопроизвести запрос от гуглбота с помощью Fidller. Раз ты пользуешься ELMAH, то можешь видеть все http заголовки из запроса приводящего к ошибке. Если так вопроизвести не получится, то откомпилируй сайт с отладочной информацией (pdb-only), чтобы увидеть в стеке номер строку где возникает NullReferenceException. Без номера строки это просто гадание получается. И заодно мелкие замечания - блок внутри using (SqlConnection ...) лучше вынести в отдельную функцию, обернуть использование reader в свой using () и убрать вызовы reader.Close()/cn.Close() т.к. с using () они не нужны. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 14.02.2012, 15:50:30 |
|
||
|
Asp.Net webForms. Почему только Google bot считает сайт недоступным?
|
|||
|---|---|---|---|
|
#18+
Попробуйте добавить Код: xml 1. Ну и смотреть очень удобно через Google Analitics. Сразу видно что да как. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 15.02.2012, 10:04:23 |
|
||
|
|

start [/forum/topic.php?fid=18&fpage=138&tid=1359939]: |
0ms |
get settings: |
12ms |
get forum list: |
24ms |
check forum access: |
5ms |
check topic access: |
5ms |
track hit: |
59ms |
get topic data: |
12ms |
get forum data: |
4ms |
get page messages: |
39ms |
get tp. blocked users: |
2ms |
| others: | 251ms |
| total: | 413ms |

| 0 / 0 |
