2011-09-05 133 views
0

可能重复:
How does Facebook Sharer select Images?Facebook的喜欢按钮 - 图像上的新闻源未显示

我添加链接按钮和OG标签。 我在linter上检查了我的页面,没有报告错误,但图像未显示。但是,如果我点击该图片所在的占位符,它会链接到正确的图片。有人知道为什么吗?

我使用asp.net MVC3,并链接到我的形象看起来像这样:http://www.domain.com/gallery/thumb/222/test-image.png

测试image.png不上服务器存在,我使用的ID(222)找到正确的图像和用内容配置显示它,测试图像仅适用于SEO。这可能是一个问题吗?

回答

0

如果您在使用卷曲尝试和检索图像(从评论)或wget的你会得到一个500:

$ wget http://noa-yachting.mlaen.com/Gallery/Thumb/99/200/hanse-495-croatia-charter.png 
--2011-09-06 07:41:49-- http://noa-yachting.mlaen.com/Gallery/Thumb/99/200/hanse-495-croatia-charter.png 
Resolving noa-yachting.mlaen.com... 178.218.172.36 
Connecting to noa-yachting.mlaen.com|178.218.172.36|:80... connected. 
HTTP request sent, awaiting response... 500 Internal Server Error 
2011-09-06 07:41:49 ERROR 500: Internal Server Error. 

$ response=`curl --write-out %{http_code} --silent -k -G http://noa-yachting.mlaen.com/Gallery/Thumb/99/200/hanse-495-croatia-charter.png` 
$ echo $response 
This error page might contain sensitive information because ASP.NET is configured to show verbose error messages using <customErrors mode="Off"/>. Consider using <customErrors mode="On"/> or <customErrors mode="RemoteOnly"/> in production environments.-->500 

只要你提供的回报图像字节和200 OK响应时,链接你发出一个HTTP GET给它,那么你会没事的。

我也下载了图像并上传到我自己的服务器,并将其添加到OG页面 - 它像一个魅力。所以,你的问题的答案是,为什么当浏览器请求时,ASP.net正确地返回图像,而不是当它被cURL或wget请求时?

我对此没有多少进展,你是否在做一些类似于创建会话时用户转到主页,然后在提供图像之前检查会话?我的确有一堆来自你的域名的cookie,所以这似乎至少是合理的。如果是这样,您需要允许所有人都可以看到该图片,或者至少可以找到Facebook抓取工具的用户代理,并始终允许其查看图片。

更新: 查看在干净的浏览器中的图像观看图像的同时仍然加载罚款的网页网址,所以我不认为这可能是问题。我从来没有使用ASP或IIS,所以我用尽想法,但这是肯定你的问题。

更新2: Got it!详细输出为cURL ftw。这是你在做什么服务器产生:

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 

[NullReferenceException: Object reference not set to an instance of an object.] 
    NoaYachting.ClientSite.Controllers.BaseController.ExecuteCore() in D:\DEV\NoaYachting\NoaYachting\NoaYachting.ClientSite\Controllers\BaseController.cs:69 
    System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +97 
    System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10 
    System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +37 
    System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +21 
    System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12 
    System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62 
    System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +50 
    System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7 
    System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +22 
    System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +60 
    System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9 
    System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8841105 
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184 

我怕你对你自己的固定是寿:)

+0

谢谢您的回答。你知道是否有其他方式,而不直接链接到实际图像? – mlaen

+0

为答案增加了额外的信息。希望这应该更清楚 – mrtom

+0

对不起,我不得不接受这个答案,当我再看看它:)这是我真正的网址(与正确的域名):http://noa-yachting.mlaen.com/Gallery/Thumb /99/200/hanse-495-croatia-charter.png,该链接在ob标签和中,并且仍然没有显示它:( – mlaen