简体   繁体   English

无法在IIS中托管Web服务

[英]Unable to host web service in IIS

I've been working on a webservice, and testing it by viewing it in a browser directly from VS2012, but now I need to host it in IIS, and for some reason, it simply will not work. 我一直在研究Web服务,并通过直接从VS2012在浏览器中查看它来对其进行测试,但是现在我需要将其托管在IIS中,由于某种原因,它根本无法工作。

I've tried publishing it as a new web application under my local IIS. 我尝试将其发布为本地IIS下的新Web应用程序。 It shows up as it should, but when I switch to Content View in IIS, right-click the MyService.svc file, and choose "browse", all I get is a new web-browser window saying the site was not found. 它按预期显示,但是当我切换到IIS中的“内容视图”时,右键单击MyService.svc文件,然后选择“浏览”,我得到的只是一个新的Web浏览器窗口,提示未找到该站点。

To check if the problem was relating to something in my service, or was general, I tried creating a new test-service from a VS project template (a new WCF Service Application ), which i compiled, ran in my browser nicely, then tried to publish to IIS, with the same result. 为了检查问题是否与服务中的某些问题有关,或者是一般性的,我尝试从VS项目模板(新的WCF服务应用程序 )创建新的测试服务,该模板经过编译,很好地在浏览器中运行,然后尝试发布到IIS,结果相同。

A little extra info: 一些额外的信息:

  • I'm working on 64-bit windows 8 我正在使用64位Windows 8
  • Both projects are in .Net 4.0 这两个项目都在.Net 4.0中
  • My configuration has Platform Target set to Any CPU 我的配置将Platform Target设置为Any CPU
  • In IIS, the services use the DefaultAppPool with default settings 在IIS中,服务使用具有默认设置的DefaultAppPool

I've been able to publish a website in IIS recently, and it works fine - I really thought the process was supposed to be just about the same for a service, but apparently I'm missing something. 我最近已经能够在IIS中发布网站,而且效果很好-我真的以为服务的过程应该差不多,但是显然我遗漏了一些东西。

Update : A little extra info in response to comments below: 更新 :一些额外的信息,以回应以下评论:

  • I'm currently trying to view the service locally 我目前正在尝试在本地查看服务
  • There is no .asmx file, only a .svc file, a web.config , and a bin/ folder in the folder where the service is published. 在发布服务的文件夹中没有.asmx文件,只有.svc文件, web.configbin/文件夹。
  • I do have a site running under the same IIS website ("Default Web Site"), and that works fine. 我的网站确实在同一个IIS网站(“默认网站”)下运行,并且工作正常。

Any tips as to what I can try in order to resolve this will be greatly appreciated.... 关于我可以尝试解决此问题的任何技巧将不胜感激。

For the record, this was what solved the problem for me: 记录下来,这就是为我解决问题的原因:

启用HTTP激活

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

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