2010-02-19 98 views
4

我从未将WCF服务部署到IIS 6之前。我有一个服务,我使用默认配置作为WCF项目的一部分,部署到IIS 6。我自从简化了可能是问题的配置思路。以下是错误我越来越如果我浏览到该服务在浏览器中:WCF部署到IIS 6导致403权限错误

HTTP Error 403.1 - Forbidden: Execute access is denied.

我的配置现在看起来是这样的:

<system.serviceModel> 
    <services> 
     <service name="MyCompany.WebServices.MyService"> 
      <endpoint address="" binding="basicHttpBinding" contract="MyCompany.WebServices.IMyService" /> 
     </service> 
    </services> 
</system.serviceModel> 

,如果我尝试将它作为ASP参考。 NET MVC,我得到以下内容:

There was an error downloading ' http://ws.mycompany.com/MyService.svc '. The request failed with HTTP status 403: Forbidden. Metadata contains a reference that cannot be resolved: ' http://ws.mycompany.com/MyService.svc '. The HTTP request was forbidden with client authentication scheme 'Anonymous'. The remote server returned an error: (403) Forbidden. If the service is defined in the current solution, try building the solution and adding the service reference again.

任何想法可能会发生什么?

更新:

这似乎是一个配置问题,在我的IIS 6盒。我假设这是因为我创建了一个全新的ASP.NET 3.5 WCF应用程序,并将其部署到一个新的URL http://ws.unitedoneresources.com/Service1.svc。如果我尝试调用该服务,则会收到上面列出的相同HTTP错误。整个服务的配置如下:

<system.serviceModel> 
    <services> 
     <service name="WcfService1.Service1" behaviorConfiguration="WcfService1.Service1Behavior"> 
     <!-- Service Endpoints --> 
     <endpoint address="" binding="wsHttpBinding" contract="WcfService1.IService1"> 
      <!-- 
       Upon deployment, the following identity element should be removed or replaced to reflect the 
       identity under which the deployed service runs. If removed, WCF will infer an appropriate identity 
       automatically. 
      --> 
      <identity> 
      <dns value="localhost"/> 
      </identity> 
     </endpoint> 
     <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> 
     </service> 
    </services> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior name="WcfService1.Service1Behavior"> 
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> 
      <serviceMetadata httpGetEnabled="true"/> 
      <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> 
      <serviceDebug includeExceptionDetailInFaults="false"/> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    </system.serviceModel> 

再次,这是一个全新的ASP.NET 3.5 WCF应用程序,所以我没有修改对项目本身的东西。

+0

服务托管在您查询的同一台计算机上吗? – Jeff 2010-02-19 22:25:54

+0

不是。一个是数据库服务器,另一个是IIS服务器。数据库调用都在使用EF的类库内部处理。 – 2010-02-22 01:37:38

+0

我已更新上述问题。我已经尝试设置IIS网站具有执行权限,重新启动IIS,并且不起作用。我也试过这个在IIS7框上无济于事。这一定是我做错了。 – 2010-02-22 16:06:34

回答

0

你不是真的给我们带来了很多在这里去 - 缺少了什么是服务器端的配置位,显示我们如何设置安全性 - 你可以请更新您的问题,我们展示里面的<system.serviceModel>一切标记在你的服务器端配置和你的客户端调用服务器?

只是从系统默认值猜测,使用basicHttpBinding会导致默认安全设置为空 - 并且看起来好像您的服务器端配置需要某种形式的安全性。它几乎看起来好像您的安全设置不同步,从而导致此错误。

另一点是:你是如何设置IIS端的?你为你的服务创建了一个虚拟目录吗?基本上,在IIS中托管时,服务URL由服务器名称(可能还有端口),* .svc文件所在的虚拟目录以及svc文件本身的名称和扩展名决定。

+0

在服务器端,我上面列出的是我现在拥有的。在客户端,再次,只是一个普通的ASP.NET MVC应用程序。 在IIS中,该服务是在一个全新的网站中设置的,其中没有任何其他内容。 – 2010-02-22 01:36:54

+0

@Jason:好的,但是你能告诉我们客户端的配置 - 必须有一些配置! – 2010-02-22 17:13:32

+0

@Jason:你为你的服务创建了一个单独的虚拟目录?你把* .svc文件放到那个目录下了吗?我似乎没有在你的URL中看到任何虚拟目录:''http:// ws.mycompany.com/MyService.svc''或者我错过了什么?通常它会是'http:// server/virtualdir/yourservice.svc'或类似的东西 - 你的网址中似乎没有“virtualdir”部分 – 2010-02-22 17:14:34

2

我搞砸了我在网站上安装WCF,在IIS 6上安装WCF(在命令提示符下使用ServiceModelReg.exe/i/x)并重新部署。有效!

谢谢!

0

我们有类似的症状,但只有在IIS 6.0下的PUT和DELETE动词。

默认情况下,我们的IIS应用程序中的.svc扩展名只允许GET,POST动词。

为应用程序的.svc扩展添加动词(或允许所有动词)修复了问题。

1

发现此问题寻找解决同一问题的方法。我忘了在服务目录中更改“脚本和可执行文件”的权限。我在II7上