运行WCF WebService的IIS上,HTTP错误404.0 - 未找到 [英] Run WCF WebService on IIS ,HTTP Error 404.0 - Not Found

查看:527
本文介绍了运行WCF WebService的IIS上,HTTP错误404.0 - 未找到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用JSON格式的WCF WebService的。
我可以在Visual Studio 2013中运行它正常,但是当我将它发布到IIS通过我的机器本地IP和特定的端口(192.168.1.6:8005)通过该地址从本地网络访问运行:

I have a WCF WebService that uses JSON format. I can run it in Visual Studio 2013 properly but when i publish it to IIS to run by my machine local ip and a specific port (192.168.1.6:8005) to access it from local network by this address :

 http://192.168.1.6:8005/Service1.svc/checkLogin?username=2&password=2&code=1

这是错误:

 HTTP Error 404.0 - Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
Detailed Error Information
Module  IIS Web Core
Notification    MapRequestHandler
Handler StaticFile
Error Code  0x80070002
Requested URL   http://192.168.1.6:8005/Service1.svc/checkLogin?kodemelli=2&password=2&bank_hesab_number=1
Physical Path   E:\testjson\Service1.svc\checkLogin
Logon Method    Anonymous
Logon User  Anonymous

三个文件分别是:Service1.svc,Web.config文件和JSONSample.dll是存在于IIS其网站的物理路径

three files namely : Service1.svc, Web.config and JSONSample.dll are exist in physical path of its IIS Website.

下面是我的web.config:

here is my web.config :

 <?xml version="1.0"?>
<!-- Copyright ©) Microsoft Corporation.  All Rights Reserved. -->
<configuration>
  <system.serviceModel>    
    <behaviors>
  <serviceBehaviors>
    <behavior name="JSONSample.Service1Behavior">
      <serviceMetadata httpGetEnabled="True" />
      <serviceDebug includeExceptionDetailInFaults="True" />
    </behavior>
  </serviceBehaviors>
  <endpointBehaviors>
    <behavior name="Web">
      <webHttp/>
    </behavior>
  </endpointBehaviors>
</behaviors>
<services>
  <service name="JSONSample.Service1" behaviorConfiguration="JSONSample.Service1Behavior">
    <host>
      <baseAddresses>
        <add baseAddress="http://192.168.1.6:8005/Service1" />
      </baseAddresses>
    </host>
    <endpoint address="" behaviorConfiguration="Web" binding="webHttpBinding" contract="JSONSample.IService1">
      <identity>
        <dns value="192.168.1.6"/>
      </identity>
    </endpoint>
    <!--<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>-->
  </service>
</services>
  </system.serviceModel>
  <system.web>
<compilation debug="true"/>
  </system.web>
  <system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<directoryBrowse enabled="true"/>
  </system.webServer>
</configuration>

和IService.cs的一部分:

And a part of IService.cs :

public interface IService1
{
    [OperationContract]
    [WebInvoke(Method = "GET", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, UriTemplate = "checkLogin?username={username}&password={password}&code={code}")]
    string checkLogin(string username, string password, string code); 

我看了非常的文章和题目来解决这个问题,但问题仍然存在。

I read very articles and topics to solve this problem, but the problem still exist.

感谢。

推荐答案

%的意见,看来这是与WCF IIS配置的问题。该 ServiceModel注册工具(ServiceModelReg.exe)工具可以运行(或重新运行)来解决这个问题。

Per the comments, it appears this was an issue with IIS configuration for WCF. The ServiceModel Registration Tool (ServiceModelReg.exe) tool can be run (or re-run) to resolve this.

这篇关于运行WCF WebService的IIS上,HTTP错误404.0 - 未找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆