При попытке получить доступ к службе с поддержкой WCF Silverlight, размещенной стандартным способом в веб-приложении, появляется ошибка ниже. Я пытаюсь вернуть список типа <ER_Theme>
в приложение Silverlight.
Это Services.References.ClientConfig, созданный в приложении Silveright:
<configuration>
<system.serviceModel>
<bindings>
<customBinding>
<binding name="CustomBinding_ER">
<binaryMessageEncoding />
<httpTransport maxReceivedMessageSize="1000000000" maxBufferSize="1000000000" />
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="http://localhost:52377/ER.svc" binding="customBinding"
bindingConfiguration="CustomBinding_ER" contract="ERService.ER"
name="CustomBinding_ER" />
</client>
</system.serviceModel>
</configuration>
Фактический код услуги:
[OperationContract]
public List<ER_Theme> GetThemes()
{
// Add your operation implementation here
using (Client_BespokeEntities myDB = new Client_BespokeEntities())
{
List<ER_Theme> myThemes;
myThemes = (from p in myDB.ER_Themes
select p).ToList();
return myThemes;
}
}
Это настройки WebConfig в веб-приложении:
<system.serviceModel>
<bindings>
<customBinding>
<binding name="SilverlightTool.Web.ER.customBinding0">
<binaryMessageEncoding />
<httpTransport />
</binding>
</customBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="SilverlightTool.Web.SilverlightServiceAspNetAjaxBehavior">
<enableWebScript />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<services>
<service name="SilverlightTool.Web.ER">
<endpoint address="" binding="customBinding" bindingConfiguration="TMPSilverlightTool.Web.ER.customBinding0" contract="SilverlightTool.Web.ER" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
Я получаю следующую ошибку:
{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.<EndGetResponse>b__4(Object sendState)
at System.Net.Browser.AsyncHelper.<>c__DisplayClass2.<BeginOnUI>b__0(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)}
Может кто-нибудь помочь мне с этим?