代码之家  ›  专栏  ›  技术社区  ›  James Alexander

WCF+WF+IIS 7虚拟路径错误

  •  0
  • James Alexander  · 技术社区  · 17 年前

    我正在尝试使用wcf和wwf构建一组服务,以供少数客户端应用程序使用。我创建了两个库(工作流和服务)和一个名为api的web应用程序。Web应用程序托管在IIS 7中。

    在api web应用程序中,我添加了一个名为inventoryservice.svc的文件,该文件的服务设置为我的工作流服务类型(存在于工作流库中),主机设置为“system.servicemodel.activiation.workflowservicehostfactory”。

    我很确定配置是正确的,但这里是:

    <system.serviceModel>
        <behaviors>
            <serviceBehaviors>
        <behavior name="SynchronizeInventoryBehavior">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
          <serviceCredentials>
            <windowsAuthentication
                allowAnonymousLogons="false"
                includeWindowsGroups="true" />
          </serviceCredentials>
        </behavior>
            </serviceBehaviors>
        </behaviors>
        <services>
            <service name="Workflows.SyncronizeInventory" 
               behaviorConfiguration="SynchronizeInventoryBehavior">
        <endpoint address=""
                  binding="wsHttpContextBinding"
                  contract="Services.IInventoryService">
        </endpoint>
        <endpoint address="mex"
                  binding="mexHttpBinding"
                  contract="IMetadataExchange">
        </endpoint>
            </service>
        </services>
    </system.serviceModel>
    

    每次尝试启动应用程序并在浏览器中浏览到inventoryservice.svc时,都会导致异常,并显示以下消息:

    虚拟路径'/is%20api/inventoryservice.svc'映射到另一个应用程序,这是不允许的。

    我以前从没见过这种例外。有人能洞察吗?堆栈跟踪在下面。谢谢!

    [ArgumentException: The virtual path '/IS%20API/InventoryService.svc' maps to another application, which is not allowed.]
       System.Web.VirtualPath.FailIfNotWithinAppRoot() +8945786
       System.Web.Compilation.BuildManager.ValidateVirtualPathInternal(VirtualPath virtualPath, Boolean allowCrossApp, Boolean codeFile) +229
       System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) +106
       System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) +101
       System.Web.Compilation.BuildManager.GetVPathBuildResult(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) +83
       System.Web.Compilation.BuildManager.GetCompiledCustomString(String virtualPath) +27
       System.ServiceModel.Activation.WorkflowServiceHostFactory.GetTypeFromString(String typeString, Uri[] baseAddresses) +248
       System.ServiceModel.Activation.WorkflowServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses) +123
       System.ServiceModel.HostingManager.CreateService(String normalizedVirtualPath) +516
       System.ServiceModel.HostingManager.ActivateService(String normalizedVirtualPath) +42
       System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath) +479
    
    [ServiceActivationException: The service '/IS API/InventoryService.svc' cannot be activated due to an exception during compilation.  The exception message is: The virtual path '/IS%20API/InventoryService.svc' maps to another application, which is not allowed..]
       System.ServiceModel.AsyncResult.End(IAsyncResult result) +11586762
       System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +194
       System.ServiceModel.Activation.HostedHttpRequestAsyncResult.ExecuteSynchronous(HttpApplication context, Boolean flowContext) +176
       System.ServiceModel.Activation.HttpModule.ProcessRequest(Object sender, EventArgs e) +278
       System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +68
       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
    

    .svc文件内容

    1 回复  |  直到 16 年前
        1
  •  1
  •   John Saunders    17 年前

    请发布.svc文件。我怀疑那是错误的路。

    您的web应用程序是否以'/is api'为根,并且是否在iis中将其配置为应用程序?是否有包含工作流服务程序集的“/is api/bin”文件夹?

    推荐文章