2017-08-25 79 views
0

我在vb.net中創建了REST WCF Web服務,並使用Web Deploy將其發佈到1 & 1主機服務器。當試圖撥打其中一項服務時,我不斷收到:WCF Web部署HTTP錯誤404 - 未找到

HTTP錯誤404 - 未找到。

您正在查找的資源已被刪除,名稱已更改或暫時不可用。

我看過wwwroot目錄,我可以找到.svc文件和web.config,所以我找不出爲什麼找不到它。我想提出的調用是:http://localhost/Service1.svc/GetTimesheetDetails/1/1/11256/2017-8-9

<OperationContract()> 
 
    <WebInvoke(Method:="GET", ResponseFormat:=WebMessageFormat.Json, BodyStyle:=WebMessageBodyStyle.Wrapped, UriTemplate:="GetTimesheetDetails/{userid}/{organisationid}/{jobid}/{sdate}")> 
 
    Function GetTimesheetDetails(ByVal userid As String, ByVal organisationid As String, ByVal jobid As String, ByVal sdate As String) As List(Of JobEngineerTime)

我已經測試了Visual Studio中運行它們這些電話,它工作得很好,可惜我無法得到它通過1 & 1運行服務器。

這是我的web.config:

<?xml version="1.0"?> 
 
<configuration> 
 

 
    <appSettings> 
 
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" /> 
 
    </appSettings> 
 
    <system.web> 
 
    <!--Disabled custom errors to allow display of detailed errors.--> 
 
    <!--<customErrors mode="Off"/>--> 
 
    <customErrors mode="RemoteOnly" defaultRedirect="~/Errors/500.htm"> 
 
     <error statusCode="404" redirect="~/Errors/404.htm"/> 
 
    </customErrors> 
 
    <compilation debug="true" strict="false" explicit="true" targetFramework="4.5" /> 
 
    <httpRuntime targetFramework="4.5"/> 
 
    </system.web> 
 
    <system.serviceModel> 
 
    <behaviors> 
 
     <endpointBehaviors> 
 
     <behavior name="webBehaviour"> 
 
      <webHttp /> 
 
     </behavior> 
 
     </endpointBehaviors> 
 
     <serviceBehaviors> 
 
     <behavior name="metadataBehavior"> 
 
      <serviceMetadata httpGetEnabled="true" /> 
 
      <serviceDebug includeExceptionDetailInFaults="true" /> 
 
     </behavior> 
 
     <behavior name=""> 
 
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" /> 
 
      <serviceDebug includeExceptionDetailInFaults="false" /> 
 
     </behavior> 
 
     </serviceBehaviors> 
 
    </behaviors> 
 
    <services> 
 
     <service behaviorConfiguration="metadataBehavior" name="WCFTimesheetWebService.Service1"> 
 
     <endpoint address="" behaviorConfiguration="webBehaviour" 
 
      binding="webHttpBinding" contract="WCFTimesheetWebService.IService1" /> 
 
     <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> 
 
     </service> 
 
     <service behaviorConfiguration="metadataBehavior" name="WCFTimesheetWebService.Service2"> 
 
     <endpoint address="" behaviorConfiguration="webBehaviour" 
 
      binding="webHttpBinding" contract="WCFTimesheetWebService.IService2" /> 
 
     <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> 
 
     </service> 
 
     <service behaviorConfiguration="metadataBehavior" name="WCFTimesheetWebService.Service3"> 
 
     <endpoint address="" behaviorConfiguration="webBehaviour" 
 
      binding="webHttpBinding" contract="WCFTimesheetWebService.IService3" /> 
 
     <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> 
 
     </service> 
 
    </services> 
 
    <protocolMapping> 
 
     <add binding="basicHttpsBinding" scheme="https" /> 
 
    </protocolMapping> 
 
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /> 
 
    </system.serviceModel> 
 
    <system.webServer> 
 
    <!-- Allowing Cross-Origin Resource Sharing (CORS) - The httpProtocol settings allow web services to be called from external domains using JavaScript--> 
 
    <httpProtocol> 
 
     <customHeaders> 
 
     <add name="Access-Control-Allow-Origin" value="*" /> 
 
     <add name="Access-Control-Allow-Headers" value="Content-Type, Accept" /> 
 
     </customHeaders> 
 
    </httpProtocol> 
 
    <modules runAllManagedModulesForAllRequests="true"/> 
 
    <httpErrors errorMode="Detailed" /> 
 
    <validation validateIntegratedModeConfiguration="false"/> 
 
    <!-- 
 
     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>

+0

這可能是託管環境的問題。我建議你與1&1交談或查看他們的支持論壇。 – Tim

回答

0

一對夫婦的映射是在IIS 「處理程序映射」 失蹤。爲了解決這個問題,我所要做的就是點擊「處理程序映射」中的「恢復到父項」,恢復丟失的映射並開始工作。