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

时间:2009-07-23 14:41:08

标签: wcf iis-7 workflow-foundation

我正在尝试使用WCF和WWF构建一组服务供一些客户端应用程序使用。我创建了2个库(工作流和服务)和1个名为API的Web应用程序。 Web应用程序托管在IIS 7中。

在API Web应用程序中,我添加了一个名为InventoryService.svc的文件,其中Service设置为我的Workflow Service类型(存在于Workflows库中),Host设置为“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 个答案:

答案 0 :(得分:1)

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

您的Web应用程序是否以'/ IS API'为根,是否在IIS中配置为应用程序?是否有来自工作流服务的程序集的“/ IS API / bin”文件夹?