Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

My Web site problem.

Options
  • 22-11-2013 1:30pm
    #1
    Registered Users Posts: 475 ✭✭


    I'm designing a simple website which includes some user log in pages. I have done the development on my own PC and everything works fine using Web Developer express 2010 with MS SQL server 2008 R2 express. I use the ASP.NET configuration tool in WDE for
    I can run the pages on my machine and log in as a user and then access the protected content. I then upload via ftp to the hosting service and I get his error when trying to log in..

    Server Error in '/' Application.

    A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

    Anyone any idea's how to solve?


Comments

  • Registered Users Posts: 7,157 ✭✭✭srsly78


    Sounds like it's still setup to use your local dev database, rather than the production one. Change the connection string.


  • Registered Users Posts: 475 ✭✭223vmax


    Many thanks for that.

    Ok I added the following to my web.config file.

    <connectionStrings>
    <add name="MMGPS" connectionString="Data Source=localhost;Initial Catalog=ASPNETDB.mdf;Integrated Security=True;" providerName="System.Data.SqlClient" />
    </connectionStrings>

    If I put my mouse over the connection string text in Database explorer it still points to the local database..... Not sure what I'm doing wrong.


  • Closed Accounts Posts: 83 ✭✭LordSinclair


    223vmax wrote: »
    Many thanks for that.

    Ok I added the following to my web.config file.

    <connectionStrings>
    <add name="MMGPS" connectionString="Data Source=localhost;Initial Catalog=ASPNETDB.mdf;Integrated Security=True;" providerName="System.Data.SqlClient" />
    </connectionStrings>

    If I put my mouse over the connection string text in Database explorer it still points to the local database..... Not sure what I'm doing wrong.

    That looks like the problem there...


  • Registered Users Posts: 710 ✭✭✭mad turnip


    MS SQL server 2008 R2 express

    I highly doubt your webhost supports Microsoft SQL server.
    That looks like the problem there...

    when you move to the webhost, localhost should refer to the webhost, (unless of course the database will be stored on a seperate server)

    I think you need to find out the database software the webhost supports and check that "localhost" corresponds to the correct server name.


  • Registered Users Posts: 2,021 ✭✭✭ChRoMe


    mad turnip wrote: »
    (unless of course the database will be stored on a seperate server)

    99% of the time it will be on another server.


  • Advertisement
  • Registered Users Posts: 851 ✭✭✭TonyStark


    mad turnip wrote: »
    I highly doubt your webhost supports Microsoft SQL server.



    when you move to the webhost, localhost should refer to the webhost, (unless of course the database will be stored on a seperate server)

    I think you need to find out the database software the webhost supports and check that "localhost" corresponds to the correct server name.

    Shared hosting? Do you have a sql server with your plan. Migrate your data and update your connection string... Basically that's it. If you need a hand DM me.


  • Registered Users Posts: 475 ✭✭223vmax


    I upgraded the db to MS SQL 2012.

    It is shared hosting and I have 1 mssql server included in my package. I can access the dB using http://mssqladmin.webapps.net No connections to the remote MSSQL are allowed via MS SQl Server management.

    I did some research and I need to include this in my code (from the provider's help section).....

    <%@ Import="" Namespace="System.Data" %>
    <%@ Import="" Namespace="System.Data.SqlClient" %>
    <script runat="server">
    sub Page_Load
    dim dbconn
    dbconn=New SqlConnection("Data Source=mssql.namesco.net;Database=dbname;User
    ID=username;Password=password")
    dbconn.Open()
    end sub
    </script>

    The problem is that I'm not sure where to include this in my source. Anyone help. Go easy as I'm new to this! I'm not uploading my localdb to the server just need to utilize and access the one provided.


  • Closed Accounts Posts: 83 ✭✭LordSinclair


    223vmax wrote: »
    I upgraded the db to MS SQL 2012.

    It is shared hosting and I have 1 mssql server included in my package. I can access the dB using http://mssqladmin.webapps.net No connections to the remote MSSQL are allowed via MS SQl Server management.

    I did some research and I need to include this in my code (from the provider's help section).....

    <%@ Import="" Namespace="System.Data" %>
    <%@ Import="" Namespace="System.Data.SqlClient" %>
    <script runat="server">
    sub Page_Load
    dim dbconn
    dbconn=New SqlConnection("Data Source=mssql.namesco.net;Database=dbname;User
    ID=username;Password=password")
    dbconn.Open()
    end sub
    </script>

    The problem is that I'm not sure where to include this in my source. Anyone help. Go easy as I'm new to this! I'm not uploading my localdb to the server just need to utilize and access the one provided.

    Are you sure you cannot connect to your remote server voa MS Server Management Studio? Before I'd even start building anything, I'd be questioning what the story is there, as I wouldn't be able to get code developed without that basic box being ticked.


  • Registered Users Posts: 475 ✭✭223vmax


    Are you sure you cannot connect to your remote server voa MS Server Management Studio? Before I'd even start building anything, I'd be questioning what the story is there, as I wouldn't be able to get code developed without that basic box being ticked.

    Yes the provider does not allow connections via MS Server Management...Makes the task a little more tricky! But like I say I can through http://mssqladmin.webapps.net


  • Closed Accounts Posts: 83 ✭✭LordSinclair


    223vmax wrote: »
    Yes the provider does not allow connections via MS Server Management...Makes the task a little more tricky! But like I say I can through http://mssqladmin.webapps.net

    Have you thought this through? I don't mean to go off topic, but say you want to look at your data in a DB table when testing code, check if an SQL insert or an update statement has been sucessful or whatever, if you can't view what is going on via the tools that MS Server Management Studio give you out of the box, you'll have to get into all sorts of convoluted shyte just to be able to see what you should be able to check at the click of a button. You'll be pulling your hair out in a development environment I think after a short time. Just to take it back to the matter at hand and your OP, you should be able to very easily test your connection string using MS Server Management Studio and see your tables, data, basically inside your DB. Your hosting provider doesn't allow it so even getting a connection string up is turning out to be a headache. How are you gonna test your code when you can't see what is going on in your DB without having to knock together more code?


  • Advertisement
  • Registered Users Posts: 475 ✭✭223vmax


    Thanks LordSinclair. The task at hand is to create a simple web site which is mostly text and image based - nothing special. I need to protect some of the content to 'members only'. I went down the route of using MS SQL as that was supported in the web design wizards. However since I'm having issues making a connection to the db with MS tools making this even more difficult would I be better off making a mySQL database rather than the MS db or will I run into the same problems with that? Could I simply create a local mySQL db along with the other project files and then ftp to provider? Many thanks for your input its much appreciated.


  • Closed Accounts Posts: 83 ✭✭LordSinclair


    223vmax wrote: »
    Thanks LordSinclair. The task at hand is to create a simple web site which is mostly text and image based - nothing special. I need to protect some of the content to 'members only'. I went down the route of using MS SQL as that was supported in the web design wizards. However since I'm having issues making a connection to the db with MS tools making this even more difficult would I be better off making a mySQL database rather than the MS db or will I run into the same problems with that? Could I simply create a local mySQL db along with the other project files and then ftp to provider? Many thanks for your input its much appreciated.

    Sounds like what I have, you can easily manage the content access by using the .NET membership provider, (but it would help if you could see your DB tables, etc). I think what I'm trying to say, is that if this is a project you have to do, and if it has to be hosted on a web domain, you would be very considerably better off from the outlet, before you write a line of code, finding a hosting provider who will at least let you use MS Server Management Studio to manage your DB. Just speaking personally, and I'm far from one of the wizards here on the forum, I picked it up as I went along, but I think you are on the road to a hiding trying to learn how to develop a website, when you can't see DB tables and data in them. It is very easily done using MS SMS, you'll end up with your head wrecked trying to insert data into a table when you are starting off, and not being able to see if the insert was successful or not, without having to go off and write up more code to see what should be visible at two clicks of a button, especially when you are at the very start of a long learning curve...


  • Registered Users Posts: 475 ✭✭223vmax


    Can I use my PC and local db for development purposes/testing etc. then upload my files apart from the db and configure the connection string to point to the provider db? I can access/view/modify the content of the online db through myLittleAdmin for SQL Server.


  • Registered Users Posts: 7,157 ✭✭✭srsly78


    The schema/structure of your local db and production db would have to match.

    For example, maybe your production database is completely empty. You would have to setup all the tables and so on before you used it. You could have some kind of initialisation step to do this programmaticly.


Advertisement