IIS发布WCF服务 - 失败,没有错误消息

时间:2022-03-17 18:25:53

I havea WCF service which I publish from Visual Studio 2008 to an IIS 6. According to the output window of VS, the publish succeeded, no error messages or warnings. When I look at IIS, the virtual directory was created, but there is no .svc listed in the directory. The directory just has my web.config and a bin. Any attempts to call my WCF service fail cause they don't exist. How can I see an error message of what's going wrong? By trial-and-error, I discovered changing my app.config before publishing will make the service show up. Namely my app.config file has these lines: <binding ...> <security mode="Transport"> <transport clientCreditionalType="None"/> </security> </binding>

我有一个WCF服务,我从Visual Studio 2008发布到IIS 6.根据VS的输出窗口,发布成功,没有错误消息或警告。当我查看IIS时,创建了虚拟目录,但目录中没有列出.svc。该目录只有我的web.config和bin。任何调用我的WCF服务的尝试都会失败,因为它们不存在。如何查看出现错误的错误消息?通过反复试验,我发现在发布之前更改我的app.config会使服务显示出来。即我的app.config文件包含以下行:

If I switch "Transport" to "None", then my service shows up on IIS. But I do have a certificate installed on IIS on the server, and as far as I can tell, everything is configured correctly on the server.

如果我将“传输”切换为“无”,则我的服务将显示在IIS上。但我确实在服务器上的IIS上安装了证书,据我所知,服务器上的所有内容都已正确配置。

There is no error message in the event log.

事件日志中没有错误消息。

How can I get a find more error messages about why the service is failing to show up?

如何找到有关服务未能显示的原因的更多错误消息?

3 个解决方案

#1


Try to copy your WCF project to your machine with IIS 6.0 as is, without using Publish of VS. If it helps, then the problem is within VS, otherwise the problem is with the IIS. Make sure .NET Framework 3.5 and ASP.NET are installed on the IIS machine. Then make sure that there are Mapping Handlers for .svc extension.

尝试使用IIS 6.0将WCF项目复制到您的计算机,而不使用发布VS.如果它有帮助,那么问题出在VS内,否则问题出在IIS上。确保IIS机器上安装了.NET Framework 3.5和ASP.NET。然后确保有.svc扩展名的映射处理程序。

Hope it helped

希望它有所帮助

#2


To find out more turn on the wcf logging. The easiest way to do this is to use the wcf configuration tool.

要了解更多信息,请打开wcf日志记录。最简单的方法是使用wcf配置工具。

Edit based on your comment: The way we publish a service is to create an msi package using the setup project. There are a couple of outputs that need to be included:

根据您的评论进行编辑:我们发布服务的方式是使用安装项目创建一个msi包。需要包含几个输出:

  1. Primary output (that is dll's) must go to the bin directory.
  2. 主输出(即dll)必须转到bin目录。

  3. Content output. You must create the svc files and mark them as content.
  4. 内容输出。您必须创建svc文件并将其标记为内容。

#3


To publish WCF service in IIS 7 or 8 you must register handler for svc extension in web.config:

要在IIS 7或8中发布WCF服务,必须在web.config中注册svc扩展的处理程序:

<system.webServer>
  <handlers>
    <add name="svc" path="*.svc" verb="*" type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
  </handlers>
</system.webServer>

(System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 for .Net 3.5)

(System.ServiceModel,Version = 3.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089 for .Net 3.5)

#1


Try to copy your WCF project to your machine with IIS 6.0 as is, without using Publish of VS. If it helps, then the problem is within VS, otherwise the problem is with the IIS. Make sure .NET Framework 3.5 and ASP.NET are installed on the IIS machine. Then make sure that there are Mapping Handlers for .svc extension.

尝试使用IIS 6.0将WCF项目复制到您的计算机,而不使用发布VS.如果它有帮助,那么问题出在VS内,否则问题出在IIS上。确保IIS机器上安装了.NET Framework 3.5和ASP.NET。然后确保有.svc扩展名的映射处理程序。

Hope it helped

希望它有所帮助

#2


To find out more turn on the wcf logging. The easiest way to do this is to use the wcf configuration tool.

要了解更多信息,请打开wcf日志记录。最简单的方法是使用wcf配置工具。

Edit based on your comment: The way we publish a service is to create an msi package using the setup project. There are a couple of outputs that need to be included:

根据您的评论进行编辑:我们发布服务的方式是使用安装项目创建一个msi包。需要包含几个输出:

  1. Primary output (that is dll's) must go to the bin directory.
  2. 主输出(即dll)必须转到bin目录。

  3. Content output. You must create the svc files and mark them as content.
  4. 内容输出。您必须创建svc文件并将其标记为内容。

#3


To publish WCF service in IIS 7 or 8 you must register handler for svc extension in web.config:

要在IIS 7或8中发布WCF服务,必须在web.config中注册svc扩展的处理程序:

<system.webServer>
  <handlers>
    <add name="svc" path="*.svc" verb="*" type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
  </handlers>
</system.webServer>

(System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 for .Net 3.5)

(System.ServiceModel,Version = 3.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089 for .Net 3.5)