WebResource地狱 - 资源无法找到 [英] WebResource Hell - resource cannot be found

查看:160
本文介绍了WebResource地狱 - 资源无法找到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

标记的JavaScript文件为嵌入的资源

新增WebResource属性,我的程序集信息类


现在我想要输出嵌入的JavaScript到我的母版页。所有我得到是从Web资源URL找不到Web资源。

Marked a javascript file as "Embedded resource"
Added WebResource attribute to my AssemblyInfo class

Now i'm trying to output the embedded javascript to my master page. All I'm getting is a "Web Resource not found" from the web resource url.


项目大会名称:


Project Assembly Name:

CompanyProduct


项目默认命名空间:


Project Default Namespace:

Company.Product.Web


位于文件的Javascript:

图书馆/ navigation.js


Javascript file located:
Library/navigation.js


程序集信息:


AssemblyInfo:

[assembly: WebResource("CompanyProduct.Library.navigation.js", "text/javascript")]


code在母版页:


Code in master page:

Page.ClientScript.RegisterClientScriptInclude("NavigationScript", Page.ClientScript.GetWebResourceUrl(this.GetType(), "CompanyProduct.Library.navigation.js"));

在'/'应用程序的服务器错误。


资源无法找到。

说明:的HTTP 404。您正在寻找(或它的一个依赖)的资源可能已被删除,更名或暂时不可用。  请检查以下URL并确保其拼写正确。
搜索结果
请求的URL:的/WebResource.axd结果版本信息:  Microsoft .NET Framework版本:2.0.50727.1433; ASP.NET版本:2.0.50727.1433

Server Error in '/' Application.

The resource cannot be found.

Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly.

Requested URL: /WebResource.axd
Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433

推荐答案

而不是 this.GetType的(),从包含该资源的程序集的类型..即:

Instead of this.GetType(), get a type from the assembly that contains the resource.. ie:

typeof(Company.Product.Web.Library.Class1)

工作的?

这篇关于WebResource地狱 - 资源无法找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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