Twitter bootstrap MVC4谷歌字体-内部网

Twitter bootstrap MVC4谷歌字体-内部网,twitter-bootstrap,asp.net-mvc-4,iis,Twitter Bootstrap,Asp.net Mvc 4,Iis,我有一个MVC4 4引导程序项目,它通过Visual Studio 2010在本地呈现得非常好,但是当我发布到用于内部网的内部IIS时,我无法访问资源http://fonts.googleapis.com/css?family=Montserrat:400有人能解释一下我是如何定位这个远程资源的,以便IIS引用它吗在当地 任何帮助都将不胜感激:-)将此代码放在head标签中 <link href='http://fonts.googleapis.com/css?family=Montser

我有一个MVC4 4引导程序项目,它通过Visual Studio 2010在本地呈现得非常好,但是当我发布到用于内部网的内部IIS时,我无法访问资源
http://fonts.googleapis.com/css?family=Montserrat:400
有人能解释一下我是如何定位这个远程资源的,以便IIS引用它吗在当地


任何帮助都将不胜感激:-)

将此代码放在head标签中

<link href='http://fonts.googleapis.com/css?family=Montserrat:400' rel='stylesheet' type='text/css'>

为了本地化谷歌字体,我添加了地址
http://fonts.googleapis.com/css?family=Montserrat:400
进入我的浏览器地址栏,返回css文件

@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 400;
  src: url(http://themes.googleusercontent.com/static/fonts/montserrat/v4/zhcz-_WihjSQC0oHJ9TCYFQlYEbsez9cZjKsNMjLOwM.eot);
  src: local('Montserrat-Regular'), url(http://themes.googleusercontent.com/static/fonts/montserrat/v4/zhcz-_WihjSQC0oHJ9TCYFQlYEbsez9cZjKsNMjLOwM.eot) format('embedded-opentype'), url(http://themes.googleusercontent.com/static/fonts/montserrat/v4/zhcz-_WihjSQC0oHJ9TCYBsxEYwM7FgeyaSgU71cLG0.woff) format('woff');
}
然后,我将上述css中的每个url添加到我的地址栏中,地址栏下载了相关的.eot和.woff文件。我只是用更合理的名称重命名下载的文件,并将文件复制到/Content/fonts目录中

然后,我将以下内容包括在boostrap.css文件中

@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 400;
  src: url(http://themes.googleusercontent.com/static/fonts/montserrat/v4/zhcz-_WihjSQC0oHJ9TCYFQlYEbsez9cZjKsNMjLOwM.eot);
  src: local('Montserrat-Regular'), url(http://themes.googleusercontent.com/static/fonts/montserrat/v4/zhcz-_WihjSQC0oHJ9TCYFQlYEbsez9cZjKsNMjLOwM.eot) format('embedded-opentype'), url(http://themes.googleusercontent.com/static/fonts/montserrat/v4/zhcz-_WihjSQC0oHJ9TCYBsxEYwM7FgeyaSgU71cLG0.woff) format('woff');
}
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 400;
  src: url(fonts/montserrat-400.eot);
  src: local('Montserrat-Regular'), url(fonts/montserrat-400.eot) format('embedded-opentype'), url(fonts/montserrat-400.woff) format('woff');
}

嘿,普雷斯托,所有字体都能在内部IIS服务器上正确呈现。

我与font awesome有一个类似的问题,下面列出的是我当前的捆绑值,这通过font-awesome.css文件中的其他引用解决了这个问题

bundles.Add(new StyleBundle("~/Framework/libs/vendor/font-awesome/4.4.0/css/font-awesome").Include(
            "~/Framework/libs/vendor/font-awesome/4.4.0/css/font-awesome.css"));

当路径与实际的css文件相对时,eot、tff和woff文件的相对路径也将变得正确。

是,但此项目正在我们的intranet IIS服务器上运行,外部访问被拒绝,因此我无法访问该资源。此回答的问题是,google使用浏览器嗅探来检测您的浏览器,然后根据它认为您的浏览器更喜欢的字体类型为您呈现正确的样式表。例如,如果你把这个链接粘贴到一个旧的IOS设备上,它会给你一个不同的样式表,把它放在IE8浏览器上,另一个样式表会用不同的字体出现。这不是一个好答案。在谷歌API上做功课,你网络上的任何人都可能有一个旧的浏览器,一个新的或旧的android的IOS设备,每个人都需要正确的样式表。