Problem with WCF services on IIS
Hi I created WCF service and run it on WebDevelopmentServer. It works fine.
Than I moved it to IIS 5.1 on Windows XP SP3. And it stop working. I have error "CityService is not defined". It's not defined because of javascript is not found. on webdevelopment server this link is working and returns javascript code http://localhost:65424/CityService.svc/js
but this link is not working, I have "The re开发者_Go百科source cannot be found" https://localhost/WebApplication1/CityService.svc/js
I can't understand why it works on development server and does not work on IIS?
can anybody help me please?
My source code are:
C# code
[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 code:
CityService.DoWork($get("txtCity").value, onSuccess);
Xml configuration:
<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>
<bindings>
<webHttpBinding >
<binding name="webBinding">
<security mode="Transport"></security>
</binding>
</webHttpBinding>
</bindings>
精彩评论