简体   繁体   English

如何在IIS中托管WCF应用程序?

[英]How Can I Host A WCF App In IIS?

I'm following Microsoft's tutorial on the topic here but it's not working and several items are unclear to me. 我正在关注微软关于此主题的教程,但它不起作用,我不清楚几个项目。 http://msdn.microsoft.com/en-us/library/ms733766.aspx http://msdn.microsoft.com/en-us/library/ms733766.aspx

  1. In step 2 it says, "ensure that ASP.NET has access to the contents of the folder". 在第2步中,它说“确保ASP.NET可以访问文件夹的内容”。 How can i do this? 我怎样才能做到这一点?
  2. Is it correct that the .cs code not be compiled? .cs代码不能编译是否正确? I've never ran .cs as a script of any kind. 我从未将.cs作为任何类型的脚本运行。

Here is my error: 这是我的错误:

HTTP Error 404.17 - Not Found
The requested content appears to be script and will not be served by the static file handler.

Thanks. 谢谢。

Could you please ensure that your apppool in which your site is running in " Integrated " mode rather than Classic . 您能否确保您的网站以“ Integrated ”模式而非Classic模式运行您的网站。

If the problem is not resolved after doing this, try to register your IIS with .netv4.0 如果执行此操作后问题仍未解决,请尝试使用.netv4.0注册IIS

For doing that 为此

Go to Command Prompt 转到命令提示符
Go to the location C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319 转到位置C:\\ Windows \\ Microsoft.NET \\ Framework \\ v4.0.30319
Register the IIS using aspnet_regiis -i command 使用aspnet_regiis -i命令注册IIS

  1. 打开IISManager并转到处理程序映射并右键单击静态文件并选择“还原为父级”

You can Host a WCF App/Service in IIS as you host simple website. 当您托管简单网站时,您可以在IIS中托管WCF应用程序/服务。 It seems to me that you are trying to access/browse .cs file. 在我看来,您正在尝试访问/浏览.cs文件。 If so, then it is not possible as it is code file. 如果是这样,那么它是不可能的,因为它是代码文件。 You should browse only your service file ie .svc file. 您应该只浏览您的服务文件,即.svc文件。

You can refer http://adarshdchaurasia.wordpress.com/2013/09/26/create-restful-wcf-service-api-using-get-post-step-by-step-guide/ to create a WCF service. 您可以参考http://adarshdchaurasia.wordpress.com/2013/09/26/create-restful-wcf-service-api-using-get-post-step-by-step-guide/来创建WCF服务。

Please ensure that: 请确保:

  • You have .Net framework 4.0 installed and enabled on your machine. 您已在计算机上安装并启用.Net framework 4.0。 If not, install or try to re-install. 如果没有,请安装或尝试重新安装。 Sometimes re-installation fix the unknown settings problem we accidentally create. 有时重新安装会修复我们意外创建的未知设置问题。
  • First try to host a simple demo web site to check if the problem is with your WCF application or with hosting process your are 首先尝试托管一个简单的演示网站,以检查问题是与您的WCF应用程序或托管进程有关
    following. 以下。

In step 2 it says, "ensure that ASP.NET has access to the contents of the folder". 在第2步中,它说“确保ASP.NET可以访问文件夹的内容”。 How can i do this? 我怎样才能做到这一点?

I think it mean make sure your folder are accessible by the IIS_IUSRS 我认为这意味着确保IIS_IUSRS可以访问您的文件IIS_IUSRS
Check the publish folder properties -> Security tab -> group or user name. 检查发布文件夹属性 - >安全性选项卡 - >组或用户名。

Make sure the app is using application pool with correct .net framework version. 确保应用程序正在使用具有正确.net框架版本的应用程序池。 normally I will just set .net framework v4.0.30319 通常我会设置.net framework v4.0.30319

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM