none
Not Able to Connect to my MS Sql Data Base on My Vps from my WCF Service Hosted on IIS7 on the same Vps RRS feed

  • Question

  • I have written a webservice from where i pass data to my localhost Ms Sql DB. It was working properly on my pc but when i hosted it on my godaddy Windows Vps there is an error:

    Request Error

    The server encountered an error processing the request. See server logs for more details.

    Please also note that there was no MS SQL Server on my vps hence i have installed it manually using my RDP. Hence idont now if there is some server setting that is to be done or i have to change my VPS. Below is my web.config please tell me what is to be done as i am stuck cant find any resources online for this problem.

    web.config

    <?xml version="1.0"?>
    <configuration>
      <connectionStrings>
        <add name="constr" connectionString="Data Source=IP-104-238-94-8;Initial Catalog=BaySideJournalDB ;Integrated Security=True" providerName="System.Data.SqlClient"/>
      </connectionStrings>
      <appSettings/>
      <system.web>
        <compilation targetFramework="4.0" debug="true"/>
        <httpRuntime/>
      </system.web>
      <system.serviceModel>
        <services>
          <service name="ShreeGanesh.BaySideService" behaviorConfiguration="ServiceBehavior">
            <endpoint address="" binding="webHttpBinding" contract="ShreeGanesh.IBaySideService" behaviorConfiguration="webHttp"/>
            <endpoint address="mex"
                    binding="mexHttpBinding" contract="IMetadataExchange" />

          </service>
        </services>
        <behaviors>
          <serviceBehaviors>
            <behavior name="ServiceBehavior">
              <serviceMetadata httpGetEnabled="true"/>
              <serviceDebug includeExceptionDetailInFaults="false"/>
            </behavior>
            <behavior>
              <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
              <serviceMetadata httpGetEnabled="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>
          <endpointBehaviors>
            <behavior name="webHttp">
              <webHttp/>
            </behavior>
          </endpointBehaviors>
        </behaviors>
           <serviceHostingEnvironment aspNetCompatibilityEnabled="false" multipleSiteBindingsEnabled="true"/>
      </system.serviceModel>
      <system.webServer>
        
        <directoryBrowse enabled="true"/>
        <defaultDocument>

          <files>
            <add value="BaySideService.svc"/>
          </files>

        </defaultDocument>
      </system.webServer>
    </configuration>

    Thursday, May 7, 2015 6:14 AM

Answers

  • Hi VJROCKS,

    Based on your MS SQL Server connectionStrings, we can see that you have set the Integrated Security as ture, then in my mind, in order to let the WCF Services can connect to the database, we need to make sure that the app pool which has been configured to run the WCF service under IIS must be granted the required permission to connect on the DB.

    For more information, please try to refer to the following thread:
    http://serverfault.com/questions/182941/wcf-application-deploying-in-iis-but-sql-server-database-connection-is-not-work .

    Besides, in WCF we also enable the WCF tracing to help find the more detailed error information.
    #Configuring Tracing:
    https://msdn.microsoft.com/en-us/library/ms733025(v=vs.110).aspx .


    Best Regards,
    Amy Peng

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, May 8, 2015 2:44 AM
    Moderator
  • Please also note that there was no MS SQL Server on my vps hence i have installed it manually using my RDP. Hence idont now if there is some server setting that is to be done or i have to change my VPS. Below is my web.config please tell me what is to be done as i am stuck cant find any resources online for this problem.

    What you need to do is put a try/catch around the code that is doing the database access, get the stack trace and the exception's innerexception.message.

    Anytime you build a solution like this, you should have some way to log exception message to a log file so you can review the exception. 

    Friday, May 8, 2015 4:21 AM

All replies

  • Hi VJROCKS,

    Based on your MS SQL Server connectionStrings, we can see that you have set the Integrated Security as ture, then in my mind, in order to let the WCF Services can connect to the database, we need to make sure that the app pool which has been configured to run the WCF service under IIS must be granted the required permission to connect on the DB.

    For more information, please try to refer to the following thread:
    http://serverfault.com/questions/182941/wcf-application-deploying-in-iis-but-sql-server-database-connection-is-not-work .

    Besides, in WCF we also enable the WCF tracing to help find the more detailed error information.
    #Configuring Tracing:
    https://msdn.microsoft.com/en-us/library/ms733025(v=vs.110).aspx .


    Best Regards,
    Amy Peng

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, May 8, 2015 2:44 AM
    Moderator
  • Please also note that there was no MS SQL Server on my vps hence i have installed it manually using my RDP. Hence idont now if there is some server setting that is to be done or i have to change my VPS. Below is my web.config please tell me what is to be done as i am stuck cant find any resources online for this problem.

    What you need to do is put a try/catch around the code that is doing the database access, get the stack trace and the exception's innerexception.message.

    Anytime you build a solution like this, you should have some way to log exception message to a log file so you can review the exception. 

    Friday, May 8, 2015 4:21 AM