HTML code不会在浏览器中运行,并且只显示code [英] html code doesn't run in the browser, and only display the code

查看:321
本文介绍了HTML code不会在浏览器中运行,并且只显示code的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了找到服务器规范。我已经创建了根目录的文件在我的网站叫spec.htm当我被其他用户提供的输入此内容:

 < HTML和GT;
    < HEAD>
        <标题>< /标题>
    < /头>
    <身体GT;
   @ ServerInfo.GetHtml()
    < /身体GT;
< / HTML>

但我只拿到code的副本,我的浏览器,它不运行它,结果
这个问题可能是什么?

编辑:我认为,问题是,我没有使用IIS结果。
有没有一种方法,而无需使用IIS这样做呢?

感谢


解决方案

请参阅下面的文章结果
http://www.asp.net/webmatrix/tutorials/14-introduction -to-调试


  

该ServerInfo助手是一种诊断工具,让你的有关承载您的网页,服务器环境信息的概述。这也显示了HTTP请求时,浏览器请求的页面发送的信息。所述ServerInfo助手显示当前用户的身份,浏览器的发出请求,等等的类型。这种信息可以帮助您解决常见问题。



  1. 创建一个名为ServerInfo.cshtml一个新的网页。

  2. 在页面的结束,在结束标记之前,添加以下突出code。

    @ ServerInfo.GetHtml()


注意,它看起来好像这样的设计在IIS,而不是只在Linux / Apache的服务器上运行。结果
注意,这是剃刀语法,所以你的系统必须能够通过安装WebMatrix的运行剃刀

in order to find the server spec. i've created a file in the root dir in my website called spec.htm and entered this content as i was offered by another user:

<html>
    <head>
        <title></title>
    </head>
    <body>
   @ServerInfo.GetHtml()
    </body>
</html>

but i only get a copy of the code in my browser and it doesn't run it,
what the problem might be?

EDIT: i think that the problem is that i'm not using IIS.
is there a way to do so without using IIS?

thanks

解决方案

Please see the following article
http://www.asp.net/webmatrix/tutorials/14-introduction-to-debugging

The ServerInfo helper is a diagnostic tool that gives you an overview of information about the web server environment that hosts your page. It also shows you HTTP request information that is sent when a browser requests the page. The ServerInfo helper displays the current user identity, the type of browser that made the request, and so on. This kind of information can help you troubleshoot common issues.

  1. Create a new web page named ServerInfo.cshtml.
  2. At the end of the page, just before the closing tag, add the following highlighted code.

    @ServerInfo.GetHtml()

Note, it appears as though this is designed to run in IIS only and not on Linux / Apache servers.
Note, this is a RAZOR syntax so your system needs to be able to run Razor by installing the WebMatrix

这篇关于HTML code不会在浏览器中运行,并且只显示code的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆