مرجع تخصصی برنامه نویسان

انجمن تخصصی برنامه نویسان فارسی زبان

تاپیک مورد نظر بسته شده است

کاربر سایت

Dr-Pantagon

عضویت از 1392/11/01

مشکل در اتصال به دیتابیس

  • چهارشنبه 9 اسفند 1396
  • 19:40
تشکر میکنم

با سلام

این اولین پروژه من با استفاده از wcf هست

یه لاگین ساده هست یوزر پسورد رو چک میکنه و true یا false بر میگردونه 

موقعه اجرا  ( ارسال اطلاعات به سرور ) این خطا رو میده

لطفا بگید مشکل از کجا هست

تشکر

Failed to invoke the service. Possible causes: The service is offline or inaccessible; the client-side configuration does not match the proxy; the existing proxy is invalid. Refer to the stack trace for more detail. You can try to recover by starting a new proxy, restoring to default configuration, or refreshing the service.

فایل کانفیگ من

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <!--<connectionStrings>
    <add name="serviceDB" connectionString="Server=72.8.23.78;Database=service;User ID=sa;Password=123456" providerName="System.Data.SqlClient" />
  </connectionStrings>-->
  <connectionStrings>
    <!--<add name="serviceDB" connectionString="Server=.;Database=service;User ID=sa;Password=Passworttt" providerName="System.Data.SqlClient" />-->
    <add name="serviceDB" connectionString="Data Source=.;Initial Catalog=service;integrated security=true"/>
  </connectionStrings>
  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  <system.web>
    <compilation debug="true" />
  </system.web>
  <!-- When deploying the service library project, the content of the config file must be added to the host's 
  app.config file. System.Configuration does not support config files for libraries. -->
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="rezaya.Irezaya" />
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost:8733" binding="basicHttpBinding"
        bindingConfiguration="rezaya.Irezaya" contract="rezaya.Irezaya"
        name="BasicHttpBinding_IFileTransfer" />
    </client>
    <services>
      <service name="rezaya.rezaya">
        <host>
          <baseAddresses>
            <add baseAddress = "http://localhost:8733" />
          </baseAddresses>
        </host>
        <!-- Service Endpoints -->
        <!-- Unless fully qualified, address is relative to base address supplied above -->
        <endpoint address="http://localhost:8733" binding="basicHttpBinding" contract="rezaya.Irezaya">
          <!-- 
              Upon deployment, the following identity element should be removed or replaced to reflect the 
              identity under which the deployed service runs.  If removed, WCF will infer an appropriate identity 
              automatically.
          -->
          <!--<identity>
            <dns value="localhost"/>
          </identity>-->
        </endpoint>
        <!-- Metadata Endpoints -->
        <!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. -->
        <!-- This endpoint does not use a secure binding and should be secured or removed before deployment -->
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
      </service>
    </services>
    <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>
  </system.serviceModel>

</configuration>

 [ServiceContract]
    public interface Irezaya
    {
        [OperationContract]
        bool login(string Username, string Password);
    }

SqlConnection oConn = new SqlConnection(ConnectionString);
            oConn.Open();
            string strQuery = "select code from T_ACL where username='" + Username + "' and pwd=" + Password + "";
            object retVal;
            SqlCommand cmd = new SqlCommand(strQuery, oConn);
            retVal = cmd.ExecuteScalar();
            if (retVal != null)
            {
                return true;
                //Authontication ok
            }
            else
            {
                return false;
                //Authontication Failed
            }

پاسخ های این پرسش

تعداد پاسخ ها : 1 پاسخ
کاربر سایت

Dr-Pantagon

عضویت از 1392/11/01

  • چهارشنبه 9 اسفند 1396
  • 21:30

مشکل حل شد بدون اینکه هیچ تغییری بدم فقط نیم ساعت سیستم رو خاموش کردم!!!frown

ببخشید نشد پاک کنم پست رو.

تشکر

کاربرانی که از این پست تشکر کرده اند

هیچ کاربری تا کنون از این پست تشکر نکرده است

تاپیک مورد نظر بسته شده و امکان درج پاسخ وجود ندارد

اگر نیاز به یک مشاور در زمینه طراحی سایت ، برنامه نویسی و بازاریابی الکترونیکی دارید

با ما تماس بگیرید تا در این مسیر همراهتان باشیم :)