【问题标题】:WCF + WF + IIS 7 Virtual Path ErrorWCF + WF + IIS 7 虚拟路径错误
【发布时间】:2009-07-23 14:41:08
【问题描述】:

我正在尝试一些新的东西,使用 WCF 和 WWF 来构建一组服务,供一些客户端应用程序使用。我正在创建 2 个库(工作流和服务)和 1 个称为 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 文件内容

【问题讨论】:

  • 有趣的是,如果我创建一个网站而不是 Web 应用程序,将我的配置和 .svc 文件复制到其中,一切正常。只是作为一个 Web 应用程序(这是我需要的),我得到了这个异常。

标签: wcf iis-7 workflow-foundation


【解决方案1】:

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

您的 Web 应用程序是否植根于“/IS API”,并且是否在 IIS 中配置为应用程序?是否存在包含来自工作流服务的程序集的“/IS API/bin”文件夹?

【讨论】:

    猜你喜欢
    • 2011-09-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-07-06
    相关资源
    最近更新 更多