Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/37.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# 正在尝试发布我的WCF服务以与Rest一起使用_C#_Asp.net_Web Services_Wcf - Fatal编程技术网

C# 正在尝试发布我的WCF服务以与Rest一起使用

C# 正在尝试发布我的WCF服务以与Rest一起使用,c#,asp.net,web-services,wcf,C#,Asp.net,Web Services,Wcf,我试图使用IIS发布我的web服务,但我的web.config似乎有问题。我想最终将我的web服务发布到我拥有的web主机上。我已准备好发布普通文件系统并将这些文件上载到Web主机,但我似乎无法让我的service.svc响应。我想这是因为我的web.config这里是代码。如果您需要我的代码的任何其他内容,请询问:D。作为备注。当我使用Visual Studio 2012运行这些服务时,它们工作得很好。我也是新手,这是我第一次尝试这么做D Web.config <configuratio

我试图使用IIS发布我的web服务,但我的web.config似乎有问题。我想最终将我的web服务发布到我拥有的web主机上。我已准备好发布普通文件系统并将这些文件上载到Web主机,但我似乎无法让我的service.svc响应。我想这是因为我的web.config这里是代码。如果您需要我的代码的任何其他内容,请询问:D。作为备注。当我使用Visual Studio 2012运行这些服务时,它们工作得很好。我也是新手,这是我第一次尝试这么做D

Web.config

<configuration> 
  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5"/>
  </system.web>
  <system.serviceModel>
    <services>
      <service name="HotelLock.Service1">
        <endpoint binding="webHttpBinding" contract="HotelLock.IService1" behaviorConfiguration="web">
        </endpoint>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="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>
      <endpointBehaviors>
        <behavior name="web">
          <webHttp/>
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <protocolMapping>
        <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>    
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" > 
    </serviceHostingEnvironment>
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <!--
        To browse web app root directory during debugging, set the value below to true.
        Set to false before deployment to avoid disclosing web app folder information.
      -->
    <directoryBrowse enabled="true"/>
  </system.webServer>
</configuration>

我将svc、web.config和带有dll的bin上传到我拥有的主机上,调用svc时得到的只是

ServiceHost Language=“C#”Debug=“true”Service=“HotelLock.Service1”codebhind=“Service1.svc.cs”

我似乎不能调用任何其他网址


当我尝试使用IIS将我的服务用作本地主机时,该页面未加载。我允许iis使用网络配置。但我似乎不能得到一个正常的错误。我就是装不下任何东西

配置文件看起来正常。也许你应该检查一下你通过浏览器调用的链接。链接应类似于以下链接:

http://www.yourdomain.com/ServiceName.ClassName.svc/UriTemplate
对于您的项目,我认为服务名称是HotelLock,类名是Service1。我不知道您代码的UriTemplate,但您的界面(可能是IService.cs)应该包含该信息(例如[WebGet(UriTemplate=“ListData”)])。最后,您的链接如下所示


我希望它能起作用。

您的问题似乎有问题-是否打算在底部发布错误消息?”因为你应该这样做。当我将文件上传到我拥有的主机并调用任何rest控制台上的服务时,会出现404错误。但是如果我调用Service1.svc,它显示的是: