-1

所以我有这个我重命名的asp.net web 应用程序。我更改了程序集名称、根命名空间、更改了所有 aspx 文件继承行以具有新名称。但由于某种原因,它仍然引用旧的程序集名称。所以主页加载,但有一个按钮提交给 pgRequest.aspx,我在事件查看器中收到此错误。

跟进:所以我重新创建了解决方案、项目并为所有表单添加了现有项目。我仍然得到这个问题。

这是从 pgMain.aspx 提交的代码

        <form id="frmNew" name="frmNew" action="pgRequest.aspx" method="post" target="_blank">
            <input type="hidden" value="frmNew" name="hdnSource"><button id="cmdNewSubmit" name="cmdNewSubmit" type="submit" value="NEW"><IMG alt="Open Form" src="images/new.gif"><span class="button_message">Open New Form</span></button>
        </form>

这是来自事件查看器的错误消息。

Could not load type 'Old_Name.pgRequest'.
--------------------
Could not load type 'Old_Name.pgRequest'.
Stack Trace:
   at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)
   at System.Web.UI.TemplateParser.ParseReader(StreamReader reader, VirtualPath virtualPath)
   at System.Web.UI.TemplateParser.ParseFile(String physicalPath, VirtualPath virtualPath)
   at System.Web.UI.TemplateParser.ParseInternal()
   at System.Web.UI.TemplateParser.Parse()
   at System.Web.UI.TemplateParser.Parse(ICollection referencedAssemblies, VirtualPath virtualPath)
   at System.Web.Compilation.BaseTemplateBuildProvider.get_CodeCompilerType()
   at System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(BuildProvider buildProvider)
   at System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders()
   at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
   at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
   at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile)
   at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile)
   at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean noAssert)
   at System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp, Boolean noAssert)
   at System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath)
   at System.Web.UI.PageHandlerFactory.System.Web.IHttpHandlerFactory2.GetHandler(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath)
   at System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig)
   at System.Web.HttpApplication.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
--------------------
Could not load type 'Old_Name.pgRequest'.
Stack Trace:
   at System.Web.UI.TemplateParser.ProcessException(Exception ex)
   at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding)
   at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)
--------------------
Could not load type 'Old_Name.pgRequest'.
Stack Trace:
   at System.Web.UI.TemplateParser.GetType(String typeName, Boolean ignoreCase, Boolean throwOnError)
   at System.Web.UI.TemplateParser.ProcessInheritsAttribute(String baseTypeName, String codeFileBaseTypeName, String src, Assembly assembly)
   at System.Web.UI.TemplateParser.PostProcessMainDirectiveAttributes(IDictionary parseData)

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
4

3 回答 3

0

发现了问题。虽然我在开发源代码中更改了 page 指令的 Inherits 行,但在我正在测试的已部署版本上并没有更改。部署更正的 aspx 文件解决了这个问题。

于 2012-06-08T18:33:15.567 回答
0

您必须更改每个资源文件中的所有名称。尝试使用 CTRL+F 并输入确切的名称,然后选中它下面的所有框并在整个项目中搜索。那应该这样做。

于 2012-06-08T19:03:54.593 回答
0

我刚刚删除了 Microsoft ASP.net 临时文件,它确实有效。路径:C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files

您检查您正在使用的版本并重置 IIS。

于 2015-04-20T09:54:35.123 回答