tags:

views:

31

answers:

1

using ASP.net, C#, IIS, jQuery

I have a wcf service running in iis on port 2515. the demo i created for this project works fine and i can utilize the service.

I have another project running on port 2971. I want this project to consume the wcf service via javascript but am getting a "method not allowed error".

Is this a cross-site scripting issue? I'm thinkin no since both projects are on the same domain but at different port numbers.

any help would be much appreciated.

    <serviceBehaviors>
      <behavior name = "MetadataBehavior">
        <serviceMetadata httpGetEnabled = "true"/>

      </behavior>
    </serviceBehaviors>

    <endpointBehaviors>
        <behavior name="SandwichServices.CostServiceAspNetAjaxBehavior" >
            <enableWebScript />
        </behavior>
    </endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<services>
           <service name="SandwichServices.CostService" behaviorConfiguration="MetadataBehavior">
        <endpoint address="" behaviorConfiguration="SandwichServices.CostServiceAspNetAjaxBehavior"
            binding="webHttpBinding" contract="SandwichServices.CostService" />
             <endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
     <host>

<baseAddresses>

  <add baseAddress="http://localhost:2152/"/&gt;

</baseAddresses>

A: 

If you're using XHR, the port is taken into account in the same-origin policy. You can't do requests across different ports - think of it as a part of the domain name.

Matti Virkkunen
there has to be some solutions though. What's the point of hosting a wcf service in IIS if i can't access it within a different project?
ErnieStings