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

时间:2010-11-09 09:21:26

标签: url-routing visual-studio-2008-sp1

我在.NET 3.5 SP1中使用基于Web的表单的URL路由。它在我的devlopement机器上工作正常但是当我用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(VirtualDirectory vdir,Boolean ignoreErrors)    在System.Web.Compilation.BuildManager.BatchCompileWebDirectory(VirtualDirectory vdir,VirtualPath virtualDir,Boolean ignoreErrors)    在System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)    在System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath,Boolean noBuild,Boolean allowCrossApp,Boolean allowBuildInPrecompile)    在System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context,VirtualPath virtualPath,Boolean noBuild,Boolean allowCrossApp,Boolean allowBuildInPrecompile)    在System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath,HttpContext context,Boolean allowCrossApp,Boolean noAssert)    在System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath,Type requiredBaseType,HttpContext context,Boolean allowCrossApp,Boolean noAssert)    在System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context,String requestType,VirtualPath virtualPath,String physicalPath)    在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)    在System.Web.HttpApplication.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()    在System.Web.HttpApplication.ExecuteStep(IExecutionStep step,Boolean& completedSynchronously)

1 个答案:

答案 0 :(得分:0)

你需要IIS 6.0或更高版本。 XP仅提供IIS 5.1。你可以试试IIS Express。