0

アプリをWCFサービスに接続しようとしています。実際のデバイスでのデバッグを除いて、すべてが正常に機能しています。タイムアウト例外を報告します。エミュレーターでの作業に問題はありません。すべて問題ありません。

これは私のメインページのコードです:

public partial class MainPage: PhoneApplicationPage
{
    // Constructor
    public MainPage()
    {
        InitializeComponent();
        ServiceReference1.WCFClient serviceClient = new ServiceReference1.WCFClient();

        serviceClient.LoadExamsAsync("Marco");
        serviceClient.LoadExamsCompleted += serviceClient_LoadExamsCompleted;


    }

    void serviceClient_LoadExamsCompleted(object sender, ServiceReference1.LoadExamsCompletedEventArgs e)
    {
        lls2.ItemsSource = e.Result; // longlistselector
    }
 }

IExams.cs から:

[ServiceContract]
public interface IExams
{

    [OperationContract]
    List<LoadExamsResult> LoadExams();

}

そして Exams.svc.cs から:

public class ExamsService : IExams
{
    public ExamsDataClassesDataContext data { get; set; }
    public ExamsService()
    {
        data = new ExamsDataClassesDataContext();
    }

    public List<LoadExamsResult> LoadExams(string un)
    {
        return data.LoadExams(un).ToList();
    }
}

LinqToSql クラスは自動的に作成され、Sql Server のデータベースからストアド プロシージャを呼び出します。

これは私の web.config ファイルです:

<?xml version="1.0"?>
<configuration>
  <connectionStrings>
    <add name="ConnectionString" connectionString="Data Source=Alex;Initial        Catalog=Ispiti;Integrated Security=True"
      providerName="System.Data.SqlClient" />
  </connectionStrings>
  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
     <httpRuntime targetFramework="4.5" executionTimeout="1200"/>
  </system.web>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the values below to false    before deployment -->
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the   value below to true.  Set to false before deployment to avoid disclosing exception  information -->
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <protocolMapping>
        <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>    
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <!--
        To browse web app root directory during debugging, set the value below to true.
         Set to false before deployment to avoid disclosing web app folder information.
      -->
    <directoryBrowse enabled="true"/>
   </system.webServer>

</configuration>

そして私の ServiceReferences.ClientConfig から

<configuration>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="basicHttpBinding_IExams" maxBufferSize="2147483647"
                    maxReceivedMessageSize="2147483647">
                    <security mode="None" />
                </binding>
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://192.168.137.146:14584/Exams.svc" binding="basicHttpBinding"
                bindingConfiguration="basicHttpBinding_IExams" contract="ServiceReference1.IExams"
                name="basicHttpBinding_IExams" />
        </client>
    </system.serviceModel>
</configuration>
4

1 に答える 1