CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Jan 2010
    Posts
    3

    C# Windows Forms deployment issues

    Hi, I am a .NET web developer by profession but I am working on a freelance project as well. The company I am doing freelance work for has no web infrastructure and wanted me to create some fairly simple database applications. I decided to use Visual C# with an Access database. The problem I am having is with deploying these applications. They all run perfectly from local machines but when placed in a network folder I then have permissions issues connecting to the database.

    I am not really doing much in the way of "deployment". All I'm doing is copying all the files in the bin\Release folder (which includes the database) to wherever I want to run it from. Obviously I need to do something to make it run from a network folder. If I can avoid it, I'd like to not have to install anything on the client machines. But if I can't, so be it. However I would like the database to reside on the network drive and be able to be accessed from everyone using the app.

    The strange thing is, my app on a network drive is currently working for 5 of 7 people at the client company. When it did not work for one user I started doing research on my permissions problems and basically what I am reading is telling me it should have worked for any of them.

    I have played around a little bit with publishing my app using ClickOnce to a network share which seems to work until I go to run it and it can't find the database. Can someone tell me the simplest way to deploy these applications to a network drive?

  2. #2
    Join Date
    Apr 2007
    Location
    Florida
    Posts
    403

    Re: C# Windows Forms deployment issues

    To make sure I understand...

    You're copying the application files to a network share, and having users run the executable from the network share?

    If so, I strongly suggest either having them copy the files down locally, and running it there. Or, creating a batch/installer that puts the files locally.

    Visual Studio has the ability to create installers or click once application packages for you. You said when you went the ClickOnce route it complained about not being able to find the database? What were the errors? How is your database lookup working? Is it a relative path? Perhaps change it to an absolute path and make sure the user has access.

    Is it impossible to setup a web infrastructure for them? Simple webservice calls will relieve all access/permission problems assuming the webservice machine has access to the Access DB.

  3. #3
    Join Date
    Jan 2010
    Posts
    3

    Re: C# Windows Forms deployment issues

    Quote Originally Posted by mariocatch View Post
    You're copying the application files to a network share, and having users run the executable from the network share?
    Yes. I kinda wanted it to work like a web app without having to install anything.

    Quote Originally Posted by mariocatch View Post
    Visual Studio has the ability to create installers or click once application packages for you. You said when you went the ClickOnce route it complained about not being able to find the database? What were the errors? How is your database lookup working? Is it a relative path? Perhaps change it to an absolute path and make sure the user has access.
    Right now my Access database is just part of the project. The connection string is just set up to connect to it residing in the same folder. I assume you are saying I should just put the database in the network folder and change my connection string accordingly. That would work for me. And it would allow me to use ClickOnce.

    Quote Originally Posted by mariocatch View Post
    Is it impossible to setup a web infrastructure for them? Simple webservice calls will relieve all access/permission problems assuming the webservice machine has access to the Access DB.
    I sure wish! This project would have been dead simple for me if I could have done in on the web. Unfortunately they don't have web infrastructure (no intranet and an outsourced internet site) and it's for a behavioral health insurance company so I'm dealing with protected health information so it's not like I can just buy them a GoDaddy account or something

    Thanks for your help.

  4. #4
    Join Date
    Apr 2006
    Posts
    220

    Re: C# Windows Forms deployment issues

    ezmobee !

    Your problem is related to the connection string of your Access database and it doesn't have anything to do with your EXE files. Do you want your EXE files on every client to connect with some CENTRAL database file (Access file) or do you want your EXE files to connect to their own database files.

    What you have done so far is the latter and what you are trying to achieve is the former. Am I right here ?

    If this is the case then you simply need to change the connection string in your App.config file to connect to some network database file.

    Change the
    Code:
    Data Source=localhost
    to
    Code:
    Data Source=MACHINE_NAME_HERE

  5. #5
    Join Date
    Dec 2007
    Location
    Vancouver
    Posts
    25

    Re: C# Windows Forms deployment issues

    How is the issue going? Does nabeelisnabeel's solution works?
    Catherine Sea
    www.dynamsoft.com
    the the leading developer of version control and issue tracking software

  6. #6
    Join Date
    Jan 2010
    Posts
    3

    Re: C# Windows Forms deployment issues

    Thanks for your help guys. I have found that the computers that were having issues did not have framework version 3.5 SP1 on them. Once we installed that, everything works fine. I did a little research and found that 3.5 SP1 made specific allowances for what I was trying to do: http://blogs.msdn.com/vancem/archive...ork-share.aspx

    Now I understand just placing the application files on a network drive and running them from there is probably not the "proper" way to do this but does anyone see any problem with it? My reason for going this route is not just laziness. The company I am doing this work for has an incompetent IT department and the department I am doing development for is trying to avoid involving IT as much as possible. Thus my desire to not have to "install" anything.

  7. #7
    Join Date
    Apr 2007
    Location
    Florida
    Posts
    403

    Re: C# Windows Forms deployment issues

    If a company has to practice poor work ethics to avoid confrontation then I feel sorry you have to be involved in the middle of that...

    You're the one getting paid, and they're the ones paying you so I guess you gotta do what they want. However, you and I both know the proper solution is not what they're asking for. You can set up an IIS on a host machine, and serve a click-once application from there. You can also create a simple batch or executable that copies the files down locally to each client's machine.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured