在precompiled Web应用程序WCF服务 - 无法加载文件或程序 [英] WCF service in a precompiled web application - Could not load file or assembly

查看:187
本文介绍了在precompiled Web应用程序WCF服务 - 无法加载文件或程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含多个无线接入点解决方案( Web应用程序项目的)。

每个WAP有它自己的 Web部署项目的,以便能够precompile这些网站。
在Web应用程序之一,我们正在创建一个新的WCF文件,

I have a solution which contains multiple WAPs (Web Application projects).
Every WAP has it's own Web Deploy project in order to be able to precompile these sites. On one of the web app we are created a new WCF file with

AspNetCompatibilityRequirementsMode.Allowed

在调试模式下,它正在确定,但如果我切换到释放它崩溃了:

(我们使用的MSBuild创建部署版本)

In debug mode it is working ok, but if i switch to release it crashes:
(we are using msbuild to create the deployable versions)

无法加载文件或程序集App_Web_的 * ,版本= 0.0.0.0,
  文化=中性公钥= null或它的一个依赖。该
  系统找不到指定的文件。

Could not load file or assembly 'App_Web_*, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

我发现这个链接一些解释:<一href=\"http://blogs.msdn.com/b/isha/archive/2009/04/04/issues-with-wcf-service-when-the-asp-net-website-is-deployed-using-the-web-deployment-project-and-as-non-updatable-project.aspx\"相对=nofollow> WCF服务

I found some explanation in this link: WCF service

WCF存储引用组件列表进入customString
  在构建结果属性(service.svc.cdcab7d2.compiled)
  包括App_Global。看来这里有个不正确的假设
  这些组件总是存在,这不一定
  在网络部署项目的情况下(aspnet_merge),其中组件
  将合并。合并步骤之后,组件实际上是所有的
  汇成作为我们一个单一的组件(让我们说MyWebSite.dll)
  选择在WDP该选项。 ASP.NET仅更新.compiled文件
  它知道,所以App_Global.asax.compiled实际上有一个正确的
  参考MyWebSite_Deploy.dll而不是App_Global.dll。原版的
  组件被合并步骤之后去除。 WCF读取的列表
  组件previously存储,并抛出时,它无法找到
  App_Global

WCF stores the list of referenced assemblies into the customString attribute in the build result (service.svc.cdcab7d2.compiled), including App_Global. It seems there is an incorrect assumption here that those assemblies will always be there, which is not necessarily the case in Web Deployment Projects (aspnet_merge) where assemblies will be merged. After the merge step, the assemblies are actually all merged into a single assembly (let us say MyWebSite.dll) as we selected that option in WDP. ASP.NET only updates the .compiled files it knows about, so App_Global.asax.compiled actually has a correct reference to MyWebSite_Deploy.dll instead of App_Global.dll. Original assemblies are removed after the merge step. WCF reads the list of assemblies previously stored, and throws when it cannot find App_Global

解决方案的名单我已经试过:

1,检查允许此precompiled网站是更新的' - 没有奏效

1.Check 'Allow this precompiled site to be updatable' - not worked

2 <一个href=\"http://social.msdn.microsoft.com/forums/en-US/wcf/thread/8c897f8e-2143-450e-a9f4-97d1f8702da7/\"相对=nofollow> 的APP_ manualy删除*从service.compile文件
参考
(它的工作,但它应该是另一种解决方案)

2.Remove manualy the App_* reference from service.compile file
(It worked but it should be another solution)

3.添加完全合格的名称为.SVC
该服务有一个完全合格的名称。

3.Add fully qualified name for the service/factory in .svc
The service has a fully qualified name.

4.tried设置此项:

&LT; SourceWebPhysicalPath&GT; .. \\ .. \\项目名&LT; / SourceWebPhysicalPath&GT;

4.tried to set this key:
<SourceWebPhysicalPath>..\..\ProjectName</SourceWebPhysicalPath>

这些说明

5 &LT;编译调试=false的一批=假&GT;

试过这种使用的这说明

6。合并所有输出到单个总成

因为它要求所有使用的组件注册到GAC并意味着我们需要改变部署逻辑我没有尝试过这一点。

6."Merge All outputs to a single assembly"
i haven't tried this because it requires to register all the used assemblies to GAC and means we need to change the deployment logic.

我不希望删除<一个href=\"http://stackoverflow.com/questions/425015/asp-net-wcf-and-could-not-load-file-or-assembly-app-web-hamznvwf\">the asp.net临时文件夹因为它停止的应用程序,这是不能接受的。

I don't want to delete the asp.net temporary folder because it stops the application and it is inacceptable

我也发现<一个href=\"http://weblogs.asp.net/scottgu/archive/2007/04/11/public-hotfix-patch-available-for-asp-net-compilation-issues.aspx\"相对=nofollow>斯科特Gutthrie链接但它从07年就是它应该做它的方式到ASP.NET 4.0

I also found Scott Gutthrie link but it's from '07 it should made it's way to asp.net 4.0

其他信息


该服务被放置:
项目名\\ WebResorce \\ Service.svc

<%@ ServiceHost ... Factory="SolutionName.SharedWeb.WadoLabsServiceHostFactory" %>

其中 SharedWeb 是一个共享的Web项目


你有什么其他的想法?

在此先感谢

where the SharedWeb is a Shared Web project

Do you have any other ideas?
Thanks in advance

推荐答案

你为什么不实现WCF服务,在同一个解决方案内的单独库项目,并简单地从你的Web应用程序(S)引用该项目?这样,他们将留出pre-编译过程中,你可以用* .SVC文件内predictable类型名称工作。另外,这很可能也给你一个清晰的解决方案结构。

Why don't you implement the WCF services in a separate library project inside the same solution, and simply reference that project from your web app(s)? That way they would stay out of the pre-compilation process, and you could work with predictable type names inside the *.svc files. Plus, this would probably also give you a cleaner solution structure.

这篇关于在precompiled Web应用程序WCF服务 - 无法加载文件或程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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