WCF服务文件不可见 [英] WCF service file not visible

查看:108
本文介绍了WCF服务文件不可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个包含多个svc文件的现有WCF服务。

We have an existing WCF service with multiple svc files.

今天,突然之间,其中一个svc文件不再有效:

Today, all of a sudden, one of the svc files no longer works:


  • 该页面在IIS内容视图中不可见(虽然其他svc文件
    是)

  • 导航时到页面,返回404错误

  • 该文件存在且在Visual Studio中的解决方案资源管理器中可见

  • 在另一台开发机器上一切正常正确

  • the page is not visible in IIS content view (although other svc files are)
  • when navigating to the page, a 404 error is returned
  • the file exists and is visible in Solution Explorer in Visual Studio
  • on a different development machine everything works correctly

我们在尝试解决此问题时尝试了以下方法:

We have tried the following in our attempts to resolve the issue:


  • 已成功创建并导航到其他svc文件 - 这使我们相信IIS配置正确。

  • 删除并重新添加相关页面。没用。

  • 重启机器

  • 重启IIS

  • successfully created and navigated to a different svc file - which leads us to believe IIS configuration is correct.
  • removing and re-adding the page in question. did not work.
  • rebooted the machine
  • restarted IIS

有关可能导致此问题的任何想法?

Any ideas about what can be causing this?

推荐答案

问题出在 applicationHost中.config 位于此处的IIS文件: C:\ Windows \ system32 \inetsrv \ config

The problem was in the applicationHost.config file of IIS located here: C:\Windows\System32\inetsrv\config

根据 MSDN


ApplicationHost.config是配置系统的根文件
当你正在使用IIS 7及更高版本。它包括所有
站点,应用程序,虚拟目录和应用程序池的定义,以及
以及Web服务器设置的全局默认值(类似于
machine.config和root web.config for .NET Framework设置)。

ApplicationHost.config is the root file of the configuration system when you are using IIS 7 and above. It includes definitions of all sites, applications, virtual directories and application pools, as well as global defaults for the web server settings (similar to machine.config and the root web.config for .NET Framework settings).

因此,一旦我们打开文件(您的普通xml配置文件),我们注意到应用程序的路径直接指向svc文件,而不是指向文件夹位置。像这样:

So once we opened up the file (your run-of-the-mill xml config file) we noticed that the path for the application was pointing directly to a svc file, rather than to a folder location. Like so:

<application path="/[APP NAME]" applicationPool="ASP.NET V4.0 Integrated">
  <virtualDirectory path="/" physicalPath="C:\Projects\[FOLDER PATH]\[APP NAME]\Service.svc" />
</application>

注意 physicalPath 属性(特别是 Service.svc ):

path="/" physicalPath="C:\Projects\[FOLDER PATH]\[APP NAME]\Service.svc"

这就是导致问题的原因。

This is what was causing the problem.

所以我们所要做的就是从路径中删除服务的名称,一切正常。像这样:

So all we had to do was remove the name of the service from the path and everything worked. Like so:

<application path="/[APP NAME]" applicationPool="ASP.NET V4.0 Integrated">
  <virtualDirectory path="/" physicalPath="C:\Projects\[FOLDER PATH]\[APP NAME]" />
</application>

这篇关于WCF服务文件不可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆