本文介绍了prerender.io IIS配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的ASP.NET应用程序中实现Prerender.io。我配置了所有必需的步骤,包括

I am trying to implement Prerender.io in my ASP.NET application. I configured all the required necessary steps including

1)< meta name =fragmentcontent =!> 在Index.html的负责人

1)<meta name="fragment" content="!"> in head of Index.html

2)配置模块

 <httpModules>
      <add name="Prerender" type="Prerender.io.PrerenderModule, IslamicMatchMakers.Web, Version=1.0.0.0, Culture=neutral" />
    </httpModules>

3)添加自定义标题

 <httpProtocol>
      <customHeaders>
        <add name="X-Prerender-Token" value="XXXX" />
      </customHeaders>
    </httpProtocol>

4)定义的重写规则

<rewrite>
      <rules>

        <!--# Only proxy the request to Prerender if it's a request for HTML-->
        <rule name="Prerender" stopProcessing="true">
          <match url="^(?!.*?(\.js|\.css|\.xml|\.less|\.png|\.jpg|\.jpeg|\.gif|\.pdf|\.doc|\.txt|\.ico|\.rss|\.zip|\.mp3|\.rar|\.exe|\.wmv|\.doc|\.avi|\.ppt|\.mpg|\.mpeg|\.tif|\.wav|\.mov|\.psd|\.ai|\.xls|\.mp4|\.m4a|\.swf|\.dat|\.dmg|\.iso|\.flv|\.m4v|\.torrent))(.*)" ignoreCase="false" />
          <conditions logicalGrouping="MatchAny">
            <add input="{HTTP_USER_AGENT}" pattern="baiduspider|facebookexternalhit|twitterbot" />
            <add input="{QUERY_STRING}" pattern="_escaped_fragment_" ignoreCase="false" />
          </conditions>
          <action type="Rewrite" url="http://service.prerender.io/http://{HTTP_HOST}/{R:1}" />
        </rule>

        <rule name="Html5Mode" stopProcessing="true">
          <match url=".*" />
          <conditions logicalGrouping="MatchAll">
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
            <add input="{URL}" pattern="/scripts/" negate="true" />
            <add input="{URL}" pattern="/content/" negate="true" />
          </conditions>
          <action type="Rewrite" url="/" />
        </rule>
      </rules>
    </rewrite>

5)我在IIS上安装了应用程序请求路由模块,我在其中启用了代理。以下是图片的外观:

5) I installed the Application Request Routing Module on IIS, in which I enable the Proxy. Here is the image how it looks like:ARR

现在,当我向 http:// localhost:2525?_escaped_fragment_ =

Now after all these configuration when I make a request to http://localhost:2525?_escaped_fragment_=

它只显示一个空白页面。我不确定我错过了什么,有人可以建议吗。

It just show me a blank page. I am not sure what I am missing, can anyone please suggest.

推荐答案

如果你不能看到任何东西'在localhost上运行。 Prerender.io服务器只能访问公共可用的网站,因此您可以尝试将代码推送到公共临时服务器......或者下载我们的开源服务器并在本地运行它以便先测试。

You won't be able to see anything if you're running on localhost. The Prerender.io servers can only access publicly available websites, so you could try pushing your code to a public staging server...or download our open source server and run it locally to test things first.

如果您对启动和运行有任何疑问,请随时给我发电子邮件! :)

Feel free to email me if you have any more questions about getting things up and running! :)

[email protected]

[email protected]

这篇关于prerender.io IIS配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-23 17:54