I have a webserver with the Default application and a Sandbox application. I now want to publish WCF services as a sub application for each. e.g.
From Visual Studio, I have configured a publish profile for Sandbox as Such
Once published, the application is available under sandbox as I expect. However, I am receiving a generic error from my browser:
*Runtime Error Description: An exception occurred while processing your request. Additionally, another exception occurred while executing the custom error page for the first exception. The request has been terminated. Looking through the Application Event Log, I see that I have a configuration error and that the application is not able to load an assembly. In this case it is DevExpress Libraries. These libraries are not referenced by the WCF services; however they are referenced by the Sandbox application. Event Log Entry Event code: 3008 Event message: A configuration error has occurred. Event time: 2/1/2018 1:06:06 PM Event time (UTC): 2/1/2018 6:06:06 PM Event ID: 54ba6fe939ec46deb0526c36e13579d3 Event sequence: 1 Event occurrence: 1 Event detail code: 0
Application information: Application domain: /LM/W3SVC/2/ROOT/Services-7-131619819656314908 Trust level: Full Application Virtual Path: /Services Application Path: \Sandbox\Services\ Machine name: Exception information: Exception type: ConfigurationErrorsException Exception message: Could not load file or assembly 'DevExpress.Web.v16.2, Version=16.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a' or one of its dependencies. The system cannot find the file specified.*
I've added references to the first couple of Devexpress Libraries, as they appeared. And the exception just points to yet another library in the root application. This is not sustainable, the two should be independent.
I created a new application pool, thinking that this was some sort of inheritance issue. That did not work.
How do I prevent the WCF services from wanting to load these libraries. And still allow these services to be published a sub applications?
Thanks in advance
答案 0 :(得分:1)
我发现了问题的根本原因和解决方案。原因在于IIS中的设计。 Web.Config文件由子应用程序从其根应用程序继承。为了防止这种情况,您可以使用两种机制:
利用$b = GCI 'E:\Temp_Images'
foreach($c in $b){
$stylist = $c.BaseName.Split("_")[2]
echo $stylist
Out-File E:\Temp_Images\$stylist.txt
}
foreach($d in $b){
$ASIN = $d.BaseName.Split(".")[0]
$ASIN | Where-Object {$_.BaseName -like $stylist} | Write-Output E:\Temp_Images\$stylist.txt
}
标记并设置inheritInChildApplications
对于不希望继承的节,属性为false。你放置
这些标签位于根应用程序的web.config。
在您的子应用程序中利用<location>
和<remove />
web.config,你想从一个干净的石板开始。
在我的场景中,我将<clear />
标记放在根web.config的system.web周围,并在我的子web.config中使用<location>
标记用于connectionStrings和appSettings