使用 .Net3.5 SP1 部署基于 Web 的 URL 路由网站时出现 ConfigurationErrorsException

发布于 2024-09-30 23:21:08 字数 3469 浏览 7 评论 0原文

我正在将 URL 路由用于基于 Web 的表单和 .NET 3.5 SP1。它在我的开发机器上工作正常,但是当我使用 windowxp 托管它时会导致异常。即使我无法打开主页。任何人请告诉我问题是什么..

Public Sub HyperLinkRoutes()
  System.Web.Routing.RouteTable.Routes.Add("Kms_Hyperlink_Document", New System.Web.Routing.Route("GetFiles/Kms_Hyperlink_Document/{DocumentID}", New RouteHandler("~/KMS/PreviewHyperlink.aspx")))
End Sub

public class RouteHandler : IRouteHandler
{
    public RouteHandler()
    {

    }
    public RouteHandler(string virtualPath)
    {
        _virtualPath = virtualPath;
    }

    public IHttpHandler GetHttpHandler(RequestContext requestContext)
    {
        if (requestContext.RouteData.Values["DocumentID"] != null)
        {
            var  display = BuildManager.CreateInstanceFromVirtualPath(
                            _virtualPath, typeof(Page)) as Page    ;
            if (display != null)
            {
                //display.DocumentID  = requestContext.RouteData.Values["DocumentID"] as string;
                foreach (var value in requestContext.RouteData.Values)
                {
                    requestContext.HttpContext.Items[value.Key] = value.Value;
                } 

                return display;
            }
            else
            {
                return null;
            }
        }
        else
        {
            return null;
        }
    }

    string _virtualPath;
}

异常信息: 异常类型:ConfigurationErrorsException 异常消息:找不到指定的模块。 (HRESULT 异常:0x8007007E)

堆栈跟踪:位于 System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName,Boolean starDirective) 在 System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() 在 System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) 在 System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) 在 System.Web.Compilation.WebDirectoryBatchCompiler..ctor(VirtualDirectory vdir) 在 System.Web.Compilation.BuildManager.BatchCompileWebDirectoryInternal(虚拟目录 vdir,布尔忽略错误) 在System.Web.Compilation.BuildManager.BatchCompileWebDirectory(VirtualDirectory vdir,VirtualPath virtualDir,布尔ignoreErrors) 在 System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) 在System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath,布尔noBuild,布尔allowCrossApp,布尔allowBuildInPrecompile) 在System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext上下文,VirtualPath virtualPath,布尔noBuild,布尔allowCrossApp,布尔allowBuildInPrecompile) 在System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath,HttpContext上下文,布尔allowCrossApp,布尔noAssert) 在System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath,类型requiredBaseType,HttpContext上下文,布尔allowCrossApp,布尔noAssert) 在System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext上下文,字符串requestType,VirtualPath virtualPath,字符串physicalPath) 在System.Web.UI.PageHandlerFactory.System.Web.IHttpHandlerFactory2.GetHandler(HttpContext上下文,字符串requestType,VirtualPath virtualPath,字符串physicalPath) 在 System.Web.HttpApplication.MapHttpHandler(HttpContext 上下文,字符串 requestType,VirtualPath 路径,字符串 pathTranslated,布尔值 useAppConfig) 在 System.Web.HttpApplication.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() 在 System.Web.HttpApplication.ExecuteStep(IExecutionStep 步骤,Boolean&completedSynchronously)

I am using URL Routing for web based form with .NET 3.5 SP1. Its work fine on my devlopement machine but when I host it with windowxp cause exception. even I m unable to open home page. any one plz what is the problem..

Public Sub HyperLinkRoutes()
  System.Web.Routing.RouteTable.Routes.Add("Kms_Hyperlink_Document", New System.Web.Routing.Route("GetFiles/Kms_Hyperlink_Document/{DocumentID}", New RouteHandler("~/KMS/PreviewHyperlink.aspx")))
End Sub

public class RouteHandler : IRouteHandler
{
    public RouteHandler()
    {

    }
    public RouteHandler(string virtualPath)
    {
        _virtualPath = virtualPath;
    }

    public IHttpHandler GetHttpHandler(RequestContext requestContext)
    {
        if (requestContext.RouteData.Values["DocumentID"] != null)
        {
            var  display = BuildManager.CreateInstanceFromVirtualPath(
                            _virtualPath, typeof(Page)) as Page    ;
            if (display != null)
            {
                //display.DocumentID  = requestContext.RouteData.Values["DocumentID"] as string;
                foreach (var value in requestContext.RouteData.Values)
                {
                    requestContext.HttpContext.Items[value.Key] = value.Value;
                } 

                return display;
            }
            else
            {
                return null;
            }
        }
        else
        {
            return null;
        }
    }

    string _virtualPath;
}

Exception information:
Exception type: ConfigurationErrorsException
Exception message: The specified module could not be found. (Exception from HRESULT: 0x8007007E)

Stack trace: at System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective)
at System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory()
at System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai)
at System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig)
at System.Web.Compilation.WebDirectoryBatchCompiler..ctor(VirtualDirectory vdir)
at System.Web.Compilation.BuildManager.BatchCompileWebDirectoryInternal(VirtualDirectory vdir, Boolean ignoreErrors)
at System.Web.Compilation.BuildManager.BatchCompileWebDirectory(VirtualDirectory vdir, VirtualPath virtualDir, Boolean ignoreErrors)
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)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

想你只要分分秒秒 2024-10-07 23:21:08

您需要 IIS 6.0 或更高版本才能完成这些工作。 XP仅提供IIS 5.1。你可以尝试一下 IIS Express 之类的东西。

You need IIS 6.0 or higher for that stuff. XP only provides IIS 5.1. You could try the IIS Express thingy.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文