2009-12-02 77 views
1

嗨我創建了WCF服務並在WebDevelopmentServer上運行它。它工作正常。IIS上的WCF服務問題

比我將它移到Windows XP SP3上的IIS 5.1。它停止工作。 我有錯誤「CityService未定義」。 由於沒有找到javascript,因此未定義。 這個鏈接工作web開發服務器返回的JavaScript代碼 http://localhost:65424/CityService.svc/js

,但這個環節不工作,我有「的資源無法找到」 https://localhost/WebApplication1/CityService.svc/js

我不明白爲什麼它的工作原理上的發展服務器,並不能在IIS上工作?

有人可以幫我嗎?

我的源代碼是:

C#代碼

[ServiceContract(Namespace = "")] 
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] 
public class CityService 
{ 
    // Add [WebGet] attribute to use HTTP GET 
    [OperationContract] 
    public string DoWork(string cityName) 
    { 
     // Add your operation implementation here 
     return "Hello " + cityName; 
    } 

    // Add more operations here and mark them with [OperationContract] 
} 

Javascript代碼:

CityService.DoWork($get("txtCity").value, onSuccess); 

xml配置:

<system.serviceModel> 
<behaviors> 
    <endpointBehaviors> 
    <behavior name="WebApplication1.CityServiceAspNetAjaxBehavior"> 
     <enableWebScript /> 
    </behavior> 
    </endpointBehaviors> 
</behaviors> 
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" > 
</serviceHostingEnvironment> 
<services> 
    <service name="WebApplication1.CityService"> 
    <endpoint address="" behaviorConfiguration="WebApplication1.CityServiceAspNetAjaxBehavior" 
     binding="webHttpBinding" contract="WebApplication1.CityService" /> 
    </service> 
</services> 

回答

0
<bindings> 
    <webHttpBinding > 
    <binding name="webBinding"> 
     <security mode="Transport"></security> 
    </binding> 
    </webHttpBinding> 
</bindings> 
+0

這不是我的解決方案 – 2014-08-06 12:52:21

+0

看我的問題http://stackoverflow.com/questions/25161076/posting-to-wcf-service-returns-404-status-after-server-migration – 2014-08-06 13:00:23