tags:

views:

60

answers:

2

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 resource 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>

A: 

Make sure you specify the right port for the service endpoint. There's no port number in your second link

Bruce Adams
What do you mean? How can I provide port for endpoint?After restarting application it start working on HTTP, but still now working on HTTPS.Do I need to make some settings for HTTPS?
Alexander Shapovalov
I made it work. providing this lines. And now it works fine, Thanks a lot <bindings> <webHttpBinding > <binding name="webBinding"> <security mode="Transport"></security> </binding> </webHttpBinding> </bindings>
Alexander Shapovalov
A: 
    <bindings>
  <webHttpBinding >
    <binding name="webBinding">
      <security mode="Transport"></security>
    </binding>
  </webHttpBinding>
</bindings>
Alexander Shapovalov