我们有一个 .net 4.8 框架 wcf 项目,该项目工作得很好并且编译得很好,但现在当我尝试访问任何端点时会抛出以下 web.config 编译错误:
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0246: The type or namespace name 'OurCompany' could not be found (are you missing a using directive or an assembly reference?)
Source Error:
Line 64: </compilation>
Line 65: <httpCookies httpOnlyCookies="false" requireSSL="false" domain="" />
Line 66: <profile enabled="true" defaultProvider="IBProfileProvider" automaticSaveEnabled="false" inherits="OurCompany.Internet.Infrastructure.IB.UserState.WebUserProfile">
Line 67: <providers>
Line 68: <clear />
Source File: c:\Web.config Line: 66
web.config 中的违规行是:
<profile enabled="true" defaultProvider="IBProfileProvider" automaticSaveEnabled="false" inherits="OurCompany.Internet.Infrastructure.IB.UserState.WebUserProfile">
<providers>
<clear />
<add name="IBProfileProvider" type="OurCompany.Imported.Microsoft.Profile.SqlProfileProvider,Infrastructure.Internet.CustomProviders, version=1.0.0.0, Culture=neutral, PublicKeyToken=null" connectionStringName="AspNetConnectionString" applicationName="/" />
</providers>
<properties />
</profile>
我已经清理并重建了每个项目,手动从每个项目中删除了 bin 和 obj,甚至重新加载了每个项目,但无济于事。即使我注释掉 web.config 中的违规行,我仍然收到此错误。
好的,找到问题了。我们最近将存储库从 azure 移至 github,而我的本地 iis 正在引用旧存储库,因此出现错误。一旦我将 iis 设置设置为正确的设置,它就可以正常工作。谢谢大家的帮助