locked
Problems publishing a very simple asp.net website to IIS RRS feed

  • Question

  • User-119808681 posted

    For months I have been crawling up the learning curve to build an application with a splash screen and two pages that show views of data from a database.  I'm doing this in VS WebExpress 2012.  and VB.NET.   The database is MS Access 2012.  I have been trying to publish this as a website to  IIS 7.5.   

    I have moved the database to to wwwroot/App_Data and restructured and tested all connections strings to match, and at design time the connection strings test out ok.  I can build and publish these three pages with no errors.  And in the unpublished test mode, all the data displays work as intended.

    So when I try to test the website of course it doesn't work, and everything points problems around the database.  The splash screen loads, and I then click on the link to the first data display page, and after much waiting get an error message:

    Server Error in '/WebSite' Application.


    The network path was not found

    The first line of a long list of error messages is:

    [SqlException (0x80131904): 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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)]
    my connection string is:
    Provider=Microsoft.ACE.OLEDB.12.0;Data Source="C:\inetpub\wwwroot\App_Data\PersonalArt Version 0055.accdb";Persist Security Info=True

     I've been exploring this part time for several weeks.  I've explored security settings in IIS, I've made sure that the connection string is replicated inside IIS.  But this error seems to be suggesting that ACE.OLDEDB.12.0 isn't being recognized as a source for a database. (Maybe it really only wants SQL?)

    Then I've noticed that instructions for WebExpress 2010 say you can't use it to publish websites, while you can publish your website in WebExpress 2012.  And then I notice that the Dialogues for publishing a website seem to have some warning about database publishing.

    When I click on Publish Web, the settings section notes that database publishing is not supported for this publish method (ok if it isn't, do I need to publish it or is it supposed to be enough to drop the database in the App_Data folder?  And if I need to publish it, how do I do it?)

    The preview section in the same vein notes that preview of databases is not supported for this publish method.

    I have the feeling that this is all really very simple, but I've been wandering around in the wrong part of the woods, without enough knowledge to read the road signs and find the right direction.

    thanks-

    Dave

    Saturday, June 8, 2013 1:12 PM

Answers

  • User-166373564 posted

    Hi Dave

     Am I missing something?  Is there a simple toggle somewhere to force debugging in the WebExpress mode?

    I'm not sure whether it is the root of your problem,

    Devenv lets you set various options for the integrated development environment (IDE), and also build, debug, and deploy projects, from the command line.

    Devenv.exe /SafeMode: Launches the IDE in safe mode loading minimal windows.

    Devenv.exe /ResetSettings: Restores the IDE's default settings, optionally resets to the specified VSSettings file.

    Devenv.exe /ResetAddin: Removes commands and command UI associated with the specified Add-in.

    Devenv.exe /ResetSkipPkgs: Clears all SkipLoading tags added to VSPack

    Moreover, I would also like to suggest you to re-create this simple asp.net website, and publish it again, perhaps it is helpful for you to troubleshoot this issue,

    Regards

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, June 18, 2013 2:10 AM

All replies

  • User1992938117 posted

    Most likely issue with File permission, Right click on App_Data folder and give full access, Also see the Mike's blog post for better understanding it.

    http://www.mikesdotnetting.com/Article/74/Solving-the-Operation-Must-Use-An-Updateable-Query-error

    Saturday, June 8, 2013 2:01 PM
  • User-119808681 posted

    Hi Rajneesh-  Thanks for the suggestion.  I gave full access to IIS_IUSRS with no luck. Same error.  Sure seemed like a reasonable thing to try, and write permissions were missing so it was a good thing to do on general principles.

    Saturday, June 8, 2013 3:39 PM
  • User1992938117 posted

    Hi Rajneesh-  Thanks for the suggestion.  I gave full access to IIS_IUSRS with no luck. Same error.  Sure seemed like a reasonable thing to try, and write permissions were missing so it was a good thing to do on general principles.

    I think I got it, Your database is not accessible coz u have published it, Use relative path of database, see below connection string

    Provider=Microsoft.ACE.OLEDB.12.0;Data Source="|DataDirectory|PersonalArt Version 0055.accdb";Persist Security Info=True

    Also remove white spaces between database names.

    If did not work then try as below links:

    http://stackoverflow.com/questions/13169526/using-a-relative-path-in-connection-string-for-access-db-in-c-sharp

    Try as below too

    string Connection = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source="+HttpContext.Current.Server.MapPath("~/App_Data/PersonalArt Version 0055.accdb")+";Persist Security Info=True;

    Saturday, June 8, 2013 3:57 PM
  • User-119808681 posted

    Sorry Rajneesh, this produces the same error.  (btw, yes, I republished and restarted IIS)

    I don't think this error message 

    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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
    is consistent with your idea that it can't find the database.  I think the problem is the dbserver itself.  And this is probably a simple fix, but I have no clue where to start.
    Saturday, June 8, 2013 6:46 PM
  • User1992938117 posted

    A network-related or instance-specific error occurred while establishing a connection to SQL Server.

    You said you used MS Access then why its asking SQL Server, do you used sql server as well (May be for login only).

    Verify the same.

    Check your web.config and see how many connection strings you have !

    Sunday, June 9, 2013 12:23 AM
  • User-119808681 posted

    Hi Rajneesh, 

    Sorry, I missed your reply.  

    Why is it asking for SQL?  I don't know.  The more I dig into this, the less I understand.  If you look at some setup dialogues, I get a feeling that there's some sort of connection between SQL and .ACE.OLEDB.12.

    I have no designed by intent login to the website (this is for an off-the-grid intranet)- anyone can do far more damage through physical access to the system.

    I have followed various suggestions elsewhere for ensuring that sQL and sqlbrowser are properly operating and the firewall isn't blocking them.

    There is probably a trivial fix, but deeply buried knowledge behind it.

    Dave

    Sunday, June 9, 2013 3:06 PM
  • User-166373564 posted

    Hi,

    As you mentioned above, you use Access  connection string to connect the Access database, but it shows a SQL Server error, you can follow these steps to find the databases running in your system, right click on computer icon->manage, it will show Computer management console, click Services[Services and Applications], it shows a series of services. If you have SQL Server in your system, you can stop SQL Server service on the right,                           

    And then you publish your website using your Access connection string above, at the same time this asp.net web application project deployment strategies are also available for you,

    # ASP.NET Web Application Project Deployment Overview

    http://msdn.microsoft.com/en-us/library/dd394698%28v=VS.100%29.aspx

    hope it helps you,

    Regards                                                                                                                                                        

    Friday, June 14, 2013 3:24 AM
  • User-119808681 posted

    Angie,

    Thanks,

    It appears that part of the problem is that moving web pages over doesn't transfer something.  When I started from scratch and recreated the pages in a web and not aspnet environment the connection string problems disappeared.  The problem is that there is some unobvious MS code behind that was invisible to me when I imported previously working pages.

    I still have to fix a problem of updating a table, can't see any difference in the update string.  There doesn't appear to be a way to for WebExpress to debug in the design/coding environment after you've posted the forms to the website.  It would greatly simplify my solving this problem if I could do the usual debugging to see what's going on, but doing it in the website looks like yet another steep learning curve.  Am I missing something?  Is there a simple toggle somewhere to force debugging in the WebExpress mode?

    Friday, June 14, 2013 9:58 PM
  • User-166373564 posted

    Hi Dave

     Am I missing something?  Is there a simple toggle somewhere to force debugging in the WebExpress mode?

    I'm not sure whether it is the root of your problem,

    Devenv lets you set various options for the integrated development environment (IDE), and also build, debug, and deploy projects, from the command line.

    Devenv.exe /SafeMode: Launches the IDE in safe mode loading minimal windows.

    Devenv.exe /ResetSettings: Restores the IDE's default settings, optionally resets to the specified VSSettings file.

    Devenv.exe /ResetAddin: Removes commands and command UI associated with the specified Add-in.

    Devenv.exe /ResetSkipPkgs: Clears all SkipLoading tags added to VSPack

    Moreover, I would also like to suggest you to re-create this simple asp.net website, and publish it again, perhaps it is helpful for you to troubleshoot this issue,

    Regards

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, June 18, 2013 2:10 AM