为什么我的样式不会显示在 Dynamics CRM 4 IFRAME 中?
我创建了一个网页 (ASP.NET),其中包含一个模仿 Dynamics CRM 样式的样式表。这将在 CRM IFRAME(表单内)中使用。
样式表引用如下:
<head id="Head1" runat="server">
<link href="Styles.css" rel="stylesheet" type="text/css" />
</head>
当我在 Visual Studio 中加载页面时,一切正常。当我将其加载到 CRM 中时,没有显示任何样式,也没有显示图像。如果我直接浏览到图像,则会收到 404 错误。但是,页面功能正常。
我已为服务器上的“所有人”设置了读取权限,以查看这是否导致问题,但没有帮助。我还尝试将纯 HTML 页面放入该文件夹中,但同样无法加载 - 再次出现 404。
该页面安装在 ISV 文件夹 ..../isv/MyProject 中。
有人可以帮忙吗?
编辑
这是在多租户系统上。在我的测试公司 (testcompany) 上,如果我浏览到 http://crm/testcompany/isv/MyProject /MyPage.aspx,页面已加载(没有样式和图像)。
如果我浏览到 http://crm/testcompany/isv/MyProject/TestImage.gif,图像未显示。
如果我浏览到 http://crm/isv/MyProject/TestImage.gif,图像显示。这是否表明服务器设置以及 CRM 处理虚拟目录的方式存在问题?
这确实意味着,如果我将样式引用设置为 /isv.MyProject/Styles.css,页面看起来是正确的。但是,由于我不知道客户将把该项目安装在哪里,所以这是不合适的。
I have created a web page (ASP.NET) that includes a stylesheet to mimic Dynamics CRM styles. This is to be used in a CRM IFRAME (within a form).
The stylesheet is referenced as follows:
<head id="Head1" runat="server">
<link href="Styles.css" rel="stylesheet" type="text/css" />
</head>
When I load the page in Visual Studio, all is well. When I load it in CRM, none of the styles are shown and no images are displayed. If I browse directly to the image, I get a 404 error. However, the pages function correctly.
I have set read permissions for "Everyone" on the server to see if that was causing a problem but it didn't help. I also tried putting a plain HTML page in the folder and that won't load either - again a 404.
The page is installed in the ISV folder ..../isv/MyProject.
Can anyone help?
EDIT
This is on a multi-tenancy system. On my test company (testcompany) if I browse to http://crm/testcompany/isv/MyProject/MyPage.aspx, the page is loaded (without styles and images).
If I browse to http://crm/testcompany/isv/MyProject/TestImage.gif, the image is not shown.
If I browse to http://crm/isv/MyProject/TestImage.gif, the image is shown. Does this suggest a problem with the server setup and the way CRM messes around with virtual directories?
This does mean that if I set the styles reference to /isv.MyProject/Styles.css, the page looks correct. However, as I don't know where the project will be installed by customers, this is inappropriate.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
问题在于 CRM 使用 ASP.NET 虚拟路径提供程序将租户名称包含在 URL 路径中。但对于 ASP.NET 处理程序未处理的文件类型,IIS 无法找到它们。
作为解决方法,您可以使用 href="../Styles.css" 之类的路径从 HTML 页面引用 CSS。
实际上,您最好使用 href="/ISV/MyProject/Styles.css" 因为当使用面向 Internet 的部署配置访问 CRM 时,路径中不包含租户名称。
The issue is that CRM uses an ASP.NET Virtual Path Provider to include the tenant name in the URL path. But for file types that are not handled by the ASP.NET handler, IIS fails to find them.
As a work around, you can reference your CSS from your HTML page using a path like href="../Styles.css"
Actually you'd probably be better off using href="/ISV/MyProject/Styles.css" because when CRM is accessed using an Internet Facing Deploy configuration, it does not include the tenant name in the path.
尽管已经回答,但这篇文章详细描述了“问题”http://blogs.msdn.com/emeadcrmsupport/archive/2010 /03/22/如何在-site-map-to-static-content-under-the-isv-folder-in-crm-4.aspx下创建一个相对URL
Although already answered, this post describes the 'problem' in detail http://blogs.msdn.com/emeadcrmsupport/archive/2010/03/22/how-to-create-a-relative-url-in-site-map-to-static-content-under-the-isv-folder-in-crm-4.aspx