Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/280.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# IIS中具有WCF服务的主机网站_C#_Asp.net Mvc_Web Services_Wcf_Iis - Fatal编程技术网

C# IIS中具有WCF服务的主机网站

C# IIS中具有WCF服务的主机网站,c#,asp.net-mvc,web-services,wcf,iis,C#,Asp.net Mvc,Web Services,Wcf,Iis,我有一个网站,其中包含一个WCF服务。我没有单独的WCF项目。在当地工作时,它工作得很好。现在我想在IIS中托管该网站,它显示404(未找到) 404(未找到) 这是托管网站后的文件夹结构 在web.config中,我提到了这样的服务模型 <system.serviceModel> <bindings> <webHttpBinding> <binding name="WebHttpEndpointBinding"&g

我有一个网站,其中包含一个WCF服务。我没有单独的WCF项目。在当地工作时,它工作得很好。现在我想在IIS中托管该网站,它显示404(未找到)

404(未找到)

这是托管网站后的文件夹结构

在web.config中,我提到了这样的服务模型

<system.serviceModel>
    <bindings>
      <webHttpBinding>
        <binding name="WebHttpEndpointBinding">
          <security mode="TransportCredentialOnly">
            <transport clientCredentialType="Windows" proxyCredentialType="Windows" />
            <!--<transport clientCredentialType="Windows"  />-->
          </security>
        </binding>
      </webHttpBinding>
    </bindings>

    <behaviors>
      <endpointBehaviors>
        <behavior name="ARAPL">
          <endpointDiscovery enabled="false" />
          <enableWebScript />
        </behavior>
      </endpointBehaviors>

      <serviceBehaviors>
        <behavior name="WCFWindowsBasicHttpBinding.Service1Behavior">
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="false" />
          <serviceAuthenticationManager authenticationSchemes="Negotiate" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
    <services>

      <service name="RiskAnalytics.Web.wcf.ExposureService" behaviorConfiguration="WCFWindowsBasicHttpBinding.Service1Behavior">
        <endpoint address="" name="webHttpEndpoint" binding="webHttpBinding" bindingConfiguration="WebHttpEndpointBinding" behaviorConfiguration="ARAPL" contract="RiskAnalytics.Web.wcf.IExposureService">
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>

    </services>
  </system.serviceModel>

这解决了我的问题。如果有人遇到问题,请参考此

我在一篇博客文章中找到了这些说明,指出了这一步骤,这一步骤对我很有效(Windows 8,64位):

确保在windows功能中,.Net framework下的两个WCF选项都被勾选

因此,请转到控制面板–>程序和功能–>打开窗口 功能打开/关闭–>功能–>添加功能–>.NET Framework X.X 特征。确保.Net framework声明它已安装,并确保 确保选中其下方的WCF激活节点(复选框) 勾选)并同时选中WCF激活下的两个选项

这些是:

* HTTP Activation
* Non-HTTP Activation

需要选择这两个选项(勾选复选框)。

听起来像是IIS配置问题。看看这个问题,看看有没有什么帮助@Jay Thank将查看它您是否在浏览器中尝试了“”(省略操作名称)?@Viru yes它说的是404-找不到文件或目录。您正在查找的资源可能已被删除、名称已更改或暂时不可用。如果在Windows 7或Server 2008 R2上,则需要在IIS上手动注册WCF 4。