Web 服务无法使用 GAC 中的类型创建类型错误

发布于 2024-10-10 09:22:42 字数 559 浏览 0 评论 0原文

遇到一个不寻常的问题时,我似乎喜欢做一些不常见的事情。

我有一个复合控件,它检查给定的 Web 服务文件是否存在于我的应用程序的根目录中,如果不存在,它会在标记中创建带有必要指令的文件以进行滚动,如下所示

<%@ WebService Language="C#" Class="Company.Project.Assembly.ClassName" %>

: ,保存到输出中。完成此步骤后,将启动应用程序池回收,以在 IIS 中呈现新页面。

该指令指向的程序集是 GAC 部署的,但由于某些任意原因,当通过 IIS 提供 ASMX 时,该程序集被忽略。如果我将程序集复制到应用程序的 BIN 目录中,则工作正常,但是,我想将此解决方案部署为我的 SharePoint 场中的 Web 部件更新,并且在我的应用程序中启用完全信任并不是我想要的途径去。

我的假设是正确的,即忽略 ASMX 文件或从 GAC 部署的程序集中的类继承的任何文件?我不明白为什么会这样,据我所知,IIS会尝试在BIN中映射程序集,如果找不到它,它会询问GAC以查看是否可以在BIN中找到它在那里,对吗?

Stuck with an unusual problem, would seem that I love doing things that's not very common.

I have a composite control, that checks to see if a given web service file exists in the root of my application, if it does not, it creates the file with the necessary directive in the markup to ball rolling, something like:

<%@ WebService Language="C#" Class="Company.Project.Assembly.ClassName" %>

which in turn, gets saved to the output. Once this step has been completed, a recycle on application pool is initiated to get the new page rendered within IIS.

My assembly that the directive points to, is GAC deployed, but for some arb reason is being ignored when the ASMX is served through IIS. If I copy the assembly into the BIN directory for the application is works fine, however, I would like to deploy this solution as a web part update within my SharePoint farm and having FULL trust enabled in my application is not a route I would like to go.

Is is correct in my assumption that ASMX files or any file that inherits from a class within a GAC deployed assembly is ignored? I don't see why this would be, as far as I'm aware, will IIS try an map the assembly in the BIN, if it could not be found will it go and interrogate the GAC to see if it can find it in there, correct?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

秋叶绚丽 2024-10-17 09:22:42

当您在 GAC 中引用 Web 服务程序集时,需要使用程序集的完整类名,如下所示:

<%@ WebService Language="C#" Class="Company.Project.Assembly.ClassName, Company。 Project.Assembly, version=1.0.0.0, Culture=neutral, PublicKeyToken=0000000000000000" %>

我们还将 Web 服务部署到 SharePoint,这对我们来说非常适合。

When you reference a web service assembly in the GAC, you need to use the full class name with assembly like this:

<%@ WebService Language="C#" Class="Company.Project.Assembly.ClassName, Company.Project.Assembly, version=1.0.0.0, Culture=neutral, PublicKeyToken=0000000000000000" %>

We also deploy web services to SharePoint, and this works perfectly for us.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文