所以我有这个我重命名的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.
答案 0 :(得分:0)
发现问题。 虽然我在开发源中更改了page指令的Inherits行,但在我测试的已部署版本上没有更改。部署更正后的aspx文件解决了这个问题。
答案 1 :(得分:0)
您必须更改每个资源文件中的所有名称。尝试使用CTRL + F并输入确切的名称,然后选中它下面的所有框并搜索整个项目。应该这样做。
答案 2 :(得分:0)
我刚删除了Microsoft ASP.net Temp文件,它确实有效。 路径: C:\ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ Temporary ASP.NET Files
您检查您所使用的版本的版本并重置IIS。