开发者

Silverlight 4 application connecting to WCF Service fails

开发者 https://www.devze.com 2023-03-03 22:47 出处:网络
Been working on a Silverlight application which connects to a WCF Service on our server. I am using .NET 4.0 for development. Everything works fine locally, but I tried deploying the WCF Service on ou

Been working on a Silverlight application which connects to a WCF Service on our server. I am using .NET 4.0 for development. Everything works fine locally, but I tried deploying the WCF Service on our server and it does not work.

The service is running fine, I checked by entering the URL in the browser. But whenever I make a call from my Silverlight application it fails with the error:

System.ServiceModel.CommunicationException: The remote server returned an error: NotFound.

The detailed error is given below with my Web.Config file. I used fiddler to check the messages and I could see the response from the server contains the text.

a:FailedAuthentication. Access Denied.

What can I do to solve this? The problem is that my hosting server does not allow Windows Authentication to be turned on in IIS. Could not find the settings for that. I am using godaddy windows hosting.

Any pointers?

Web.Config:

    <authentication mode="Windows"/>
<customErrors mode="Off"/>
    <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/></system.web>
<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"></serviceHostingEnvironment>    
<services>
  <service name="WarpArtOnline.Service1" behaviorConfiguration="WarpArtOnline.Service1Behavior">
    <endpoint binding="basicHttpBinding" bindingConfiguration="MaxSizeBinding" contract="WarpArtOnline.IService1">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <!--<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>-->
  </service>
</services>

<bindings>
  <basicHttpBinding>
    <binding name="MaxSizeBinding" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
      <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
      <security mode="None">
        <!--<transport clientCredentialType="Windows"/>-->
        <!--<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
        <message clientCredentialType="UserName" algorithmSuite="Default" />-->
      </security>
    </binding>
  </basicHttpBinding>
</bindings>


    <behaviors>
        <serviceBehaviors>
            <behavior name="WarpArtOnline.Service1Behavior">
                <serviceMetadata httpGetEnabled="true"/>
                <serviceDebug includeExceptionDetailInFaults="true"/>
      <dataContractSerializer maxItemsInObjectGraph="2147483647" />
            </behavior>
        </serviceBehaviors>
    </behaviors>
</system.serviceModel>

Error: {System.ServiceModel.CommunicationException: The remote server returned an error: NotFound. ---> System.Net.WebException: The remote server returned an error: NotFound. ---> System.Net.WebException: The remote server returned an error: NotFound. at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult) at System.Net.Browser.BrowserHttpWebRequest.<>c_DisplayClass5.b_4(Object sendState) at System.Net.Browser.AsyncHelper.<>c_DisplayClass4.b_1(Object sendState) --- End of inner exception stack trace --- at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state) at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult) at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result) --- End of inner exception stack trace --- at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result) at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result) at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result) at System.ServiceModel.ClientBase1.Channe开发者_开发知识库lBase1.EndInvoke(String methodName, Object[] args, IAsyncResult result) at ImagingSL.WebWarp.Service1Client.Service1ClientChannel.EndwarpImage(IAsyncResult result) at ImagingSL.WebWarp.Service1Client.ImagingSL.WebWarp.IService1.EndwarpImage(IAsyncResult result) at ImagingSL.WebWarp.Service1Client.OnEndwarpImage(IAsyncResult result) at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)}


Are you using a ServiceReferences.ClientConfig file in your Silverlight project? If so have you checked all the endpoint settings?


Have you modified the clientaccesspolicy.xml file? You need to enable cross domain access in this file.Refer to this Making a Service Available Across Domain Boundaries

0

精彩评论

暂无评论...
验证码 换一张
取 消