error running off IIS

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • gerryR

    error running off IIS

    Hi All

    I've a simple web app that pulls data from an excel sheet into a small aspx
    page. When I browse the site through VS2005 everything works fine. When I
    copy the project to IIS wwwroot folder I get a

    ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found
    and no default driver specified
    [OdbcException (0x80131937): ERROR [IM002] [Microsoft][ODBC Driver Manager]
    Data source name not found and no default driver specified]



    Below is my connection string stored in web.config

    <connectionStri ngs>
    <add name="Connectio nString5" connectionStrin g="DSN=Excel
    Files;DBQ=C:\In etpub\wwwroot\A 2Z.xls;;Default Dir=C:\Inetpub\ wwwroot\;Driver Id=1046;MaxBuff erSize=2048;Pag eTimeout=5;"
    providerName="S ystem.Data.Odbc "/>
    </connectionStrin gs>

    Don't think its a permissions problem as for testing purposes I've given
    "everyone" read write access to the wwwroot.

    Really appreciate any help, am fairly new to this so apologies if its an
    obvious solution. If you need any more info just ask.

    Rgds
    Gerry


  • Jeff Dillon

    #2
    Re: error running off IIS

    "gerryR" <gerryr@noSPAM. comwrote in message
    news:OA$%23S4BQ JHA.4992@TK2MSF TNGP05.phx.gbl. ..
    Hi All
    >
    I've a simple web app that pulls data from an excel sheet into a small
    aspx page. When I browse the site through VS2005 everything works fine.
    When I copy the project to IIS wwwroot folder I get a
    >
    ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found
    and no default driver specified
    [OdbcException (0x80131937): ERROR [IM002] [Microsoft][ODBC Driver
    Manager] Data source name not found and no default driver specified]
    >
    >
    >
    Below is my connection string stored in web.config
    >
    <connectionStri ngs>
    <add name="Connectio nString5" connectionStrin g="DSN=Excel
    Files;DBQ=C:\In etpub\wwwroot\A 2Z.xls;;Default Dir=C:\Inetpub\ wwwroot\;Driver Id=1046;MaxBuff erSize=2048;Pag eTimeout=5;"
    providerName="S ystem.Data.Odbc "/>
    </connectionStrin gs>
    >
    Don't think its a permissions problem as for testing purposes I've given
    "everyone" read write access to the wwwroot.
    >
    Really appreciate any help, am fairly new to this so apologies if its an
    obvious solution. If you need any more info just ask.
    Debug your app to ensure that it is reading the config file correctly. Write
    the connection string back to the client


    Comment

    • Mark Rae [MVP]

      #3
      Re: error running off IIS

      "gerryR" <gerryr@noSPAM. comwrote in message
      news:OA$%23S4BQ JHA.4992@TK2MSF TNGP05.phx.gbl. ..
      ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found
      and no default driver specified
      [OdbcException (0x80131937): ERROR [IM002] [Microsoft][ODBC Driver
      Manager] Data source name not found and no default driver specified]
      Firstly, is there a reason that you're trying to use ODBC instead of OleDb?
      Assuming there isn't, change your connection string to the following:

      Provider=Micros oft.Jet.OLEDB.4 .0;Data
      Source=C:\Inetp ub\wwwroot\A2Z. xls;Extended Properties="Exc el
      8.0;HDR=Yes;IME X=1";

      or, if that doesn't work, try this:

      OLEDB;Provider= Microsoft.Jet.O LEDB.4.0;Data
      Source=C:\Inetp ub\wwwroot\A2Z. xls;Extended Properties="Exc el
      8.0;HDR=Yes;IME X=1";

      See here for further details:
      404 - Page Not Found. Shown when a URL cannot be mapped to any kind of resource.


      Also, you appear to have a double semi-colon in your connection string,
      though I doubt that will make any difference.
      Don't think its a permissions problem as for testing purposes I've given
      "everyone" read write access to the wwwroot.
      Not a good idea anyway. If you place the Excel workbook in your app's
      App_Data folder and change the connection string accordingly, does it
      work...?



      --
      Mark Rae
      ASP.NET MVP


      Comment

      • Mark Rae [MVP]

        #4
        Re: error running off IIS

        "Mark Rae [MVP]" <mark@markNOSPA Mrae.netwrote in message
        news:%23clODRFQ JHA.576@TK2MSFT NGP06.phx.gbl.. .
        Firstly, is there a reason that you're trying to use ODBC instead of
        OleDb? Assuming there isn't, change your connection string to the
        following:
        >
        Provider=Micros oft.Jet.OLEDB.4 .0;Data
        Source=C:\Inetp ub\wwwroot\A2Z. xls;Extended Properties="Exc el
        8.0;HDR=Yes;IME X=1";
        Sorry, omitted to mention that you will need to change the providerName to
        System.Data.Ole Db


        --
        Mark Rae
        ASP.NET MVP


        Comment

        • gerryR

          #5
          Re: error running off IIS

          Hi and thanks for the help Mark

          There was no reason for using ODBC other than I'm new to this and that's one
          method I tried that worked (at least through VS)

          I've tried the connection string below:

          <add name="Connectio nString5" connectionStrin g="OLEDB;
          Provider='Micro soft.Jet.OLEDB. 4.0;' Data
          Source=C:\Inetp ub\wwwroot\App_ Data\A2Z.xls; Extended Properties=Exce l
          8.0;HDR=Yes;IME X=1;" providerName="S ystem.Data.OleD b" />

          I'm now getting the error below:

          Format of the initialization string does not conform to specification
          starting at index 0

          I'm searching for a solution but said I'd post it here in case the problem
          was obvious to you?

          Thanks for the info on the App_Data folder, I'll be sure to use that from
          now on too.

          Regards
          Gerry


          "Mark Rae [MVP]" <mark@markNOSPA Mrae.netwrote in message
          news:%23clODRFQ JHA.576@TK2MSFT NGP06.phx.gbl.. .
          "gerryR" <gerryr@noSPAM. comwrote in message
          news:OA$%23S4BQ JHA.4992@TK2MSF TNGP05.phx.gbl. ..
          >
          >ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found
          >and no default driver specified
          >[OdbcException (0x80131937): ERROR [IM002] [Microsoft][ODBC Driver
          >Manager] Data source name not found and no default driver specified]
          >
          Firstly, is there a reason that you're trying to use ODBC instead of
          OleDb? Assuming there isn't, change your connection string to the
          following:
          >
          Provider=Micros oft.Jet.OLEDB.4 .0;Data
          Source=C:\Inetp ub\wwwroot\A2Z. xls;Extended Properties="Exc el
          8.0;HDR=Yes;IME X=1";
          >
          or, if that doesn't work, try this:
          >
          OLEDB;Provider= Microsoft.Jet.O LEDB.4.0;Data
          Source=C:\Inetp ub\wwwroot\A2Z. xls;Extended Properties="Exc el
          8.0;HDR=Yes;IME X=1";
          >
          See here for further details:
          404 - Page Not Found. Shown when a URL cannot be mapped to any kind of resource.

          >
          Also, you appear to have a double semi-colon in your connection string,
          though I doubt that will make any difference.
          >
          >Don't think its a permissions problem as for testing purposes I've given
          >"everyone" read write access to the wwwroot.
          >
          Not a good idea anyway. If you place the Excel workbook in your app's
          App_Data folder and change the connection string accordingly, does it
          work...?

          >
          >
          --
          Mark Rae
          ASP.NET MVP
          http://www.markrae.net

          Comment

          • Mark Rae [MVP]

            #6
            Re: error running off IIS

            "gerryR" <gerryr@noSPAM. comwrote in message
            news:eJsG90PQJH A.4256@TK2MSFTN GP03.phx.gbl...
            There was no reason for using ODBC other than I'm new to this and that's
            one method I tried that worked (at least through VS)
            OK. Generally speaking, data access technology priority in .NET would be a
            native .NET data provider first, then OleDb, then if all else fails, ODBC...
            I've tried the connection string below:
            >
            <add name="Connectio nString5" connectionStrin g="OLEDB;
            Provider='Micro soft.Jet.OLEDB. 4.0;' Data
            Source=C:\Inetp ub\wwwroot\App_ Data\A2Z.xls; Extended Properties=Exce l
            8.0;HDR=Yes;IME X=1;" providerName="S ystem.Data.OleD b" />
            >
            I'm now getting the error below:
            >
            Format of the initialization string does not conform to specification
            starting at index 0
            Firstly, remove the single quotes around the Provider element - does it work
            now?

            Secondly, remove the first OLEDB; parameter - does it work now?

            Finally, the App_Data folder goes in your web application's virtual
            directory, not in wwwroot...


            --
            Mark Rae
            ASP.NET MVP


            Comment

            • gerryR

              #7
              Re: error running off IIS

              Hi Mark,

              Thanks for the quick reply and apologies for all the questions!

              If I remove the single quotes I get an error saying there's no providor
              specified

              If I remove the OLEDB; I still get the format of the initialization string
              error.

              And I'm afraid I don't quiet follow regarding the App_Data question, I've
              tried a few different paths but none seem to work (is that what you mean?)

              Thanks
              gerryR


              "Mark Rae [MVP]" <mark@markNOSPA Mrae.netwrote in message
              news:eszYF8PQJH A.420@TK2MSFTNG P03.phx.gbl...
              "gerryR" <gerryr@noSPAM. comwrote in message
              news:eJsG90PQJH A.4256@TK2MSFTN GP03.phx.gbl...
              >
              >There was no reason for using ODBC other than I'm new to this and that's
              >one method I tried that worked (at least through VS)
              >
              OK. Generally speaking, data access technology priority in .NET would be a
              native .NET data provider first, then OleDb, then if all else fails,
              ODBC...
              >
              >I've tried the connection string below:
              >>
              ><add name="Connectio nString5" connectionStrin g="OLEDB;
              >Provider='Micr osoft.Jet.OLEDB .4.0;' Data
              >Source=C:\Inet pub\wwwroot\App _Data\A2Z.xls; Extended Properties=Exce l
              >8.0;HDR=Yes;IM EX=1;" providerName="S ystem.Data.OleD b" />
              >>
              >I'm now getting the error below:
              >>
              >Format of the initialization string does not conform to specification
              >starting at index 0
              >
              Firstly, remove the single quotes around the Provider element - does it
              work now?
              >
              Secondly, remove the first OLEDB; parameter - does it work now?
              >
              Finally, the App_Data folder goes in your web application's virtual
              directory, not in wwwroot...
              >
              >
              --
              Mark Rae
              ASP.NET MVP
              http://www.markrae.net

              Comment

              • Mark Rae [MVP]

                #8
                Re: error running off IIS

                "gerryR" <gerryr@noSPAM. comwrote in message
                news:%231Jx8CQQ JHA.4492@TK2MSF TNGP06.phx.gbl. ..
                >Firstly, remove the single quotes around the Provider element - does it
                >work now?
                >
                If I remove the single quotes I get an error saying there's no providor
                specified
                >Secondly, remove the first OLEDB; parameter - does it work now?
                >
                If I remove the OLEDB; I still get the format of the initialization string
                error.
                >Finally, the App_Data folder goes in your web application's virtual
                >directory, not in wwwroot...
                >
                And I'm afraid I don't quiet follow regarding the App_Data question, I've
                tried a few different paths but none seem to work (is that what you mean?)
                App_Data is a special ASP.NET folder which goes into your web application's
                virtual directory - it's part of your web application. E.g.

                <root>
                <MyWeb>
                App_Data
                A2Z.xls
                <otherFolder1 >
                file.aspx
                <otherFolder2 >
                file2.aspx
                default.aspx
                global.asax
                web.config

                That's where your Excel file should be placed. Therefore, your connection
                string would look like this - I've split it out for clarity:

                <add name="Connectio nString5"
                connectionStrin g="
                Provider=Micros oft.Jet.OLEDB.4 .0;
                Data Source=App_Data \A2Z.xls;
                Extended Properties=&quo t;Excel 8.0;HDR=Yes;IME X=1;&quot;
                "
                providerName="S ystem.Data.OleD b" />

                Concatenate it onto a single line in web.config

                See here for further examples:
                404 - Page Not Found. Shown when a URL cannot be mapped to any kind of resource.



                --
                Mark Rae
                ASP.NET MVP


                Comment

                • gerryR

                  #9
                  Re: error running off IIS

                  Hi Mark

                  Thanks for that, I had tried that all right but was getting the same error.

                  I've brought the project home and will have a go over the weekend using your
                  connection string.

                  Will post back Mon if I have any joy

                  Thanks again for all your help
                  gerryR


                  "Mark Rae [MVP]" <mark@markNOSPA Mrae.netwrote in message
                  news:Olc6ISQQJH A.4424@TK2MSFTN GP06.phx.gbl...
                  "gerryR" <gerryr@noSPAM. comwrote in message
                  news:%231Jx8CQQ JHA.4492@TK2MSF TNGP06.phx.gbl. ..
                  >
                  >>Firstly, remove the single quotes around the Provider element - does it
                  >>work now?
                  >>
                  >If I remove the single quotes I get an error saying there's no providor
                  >specified
                  >
                  >>Secondly, remove the first OLEDB; parameter - does it work now?
                  >>
                  >If I remove the OLEDB; I still get the format of the initialization
                  >string error.
                  >
                  >>Finally, the App_Data folder goes in your web application's virtual
                  >>directory, not in wwwroot...
                  >>
                  >And I'm afraid I don't quiet follow regarding the App_Data question, I've
                  >tried a few different paths but none seem to work (is that what you
                  >mean?)
                  >
                  App_Data is a special ASP.NET folder which goes into your web
                  application's virtual directory - it's part of your web application. E.g.
                  >
                  <root>
                  <MyWeb>
                  App_Data
                  A2Z.xls
                  <otherFolder1 >
                  file.aspx
                  <otherFolder2 >
                  file2.aspx
                  default.aspx
                  global.asax
                  web.config
                  >
                  That's where your Excel file should be placed. Therefore, your connection
                  string would look like this - I've split it out for clarity:
                  >
                  <add name="Connectio nString5"
                  connectionStrin g="
                  Provider=Micros oft.Jet.OLEDB.4 .0;
                  Data Source=App_Data \A2Z.xls;
                  Extended Properties=&quo t;Excel 8.0;HDR=Yes;IME X=1;&quot;
                  "
                  providerName="S ystem.Data.OleD b" />
                  >
                  Concatenate it onto a single line in web.config
                  >
                  See here for further examples:
                  404 - Page Not Found. Shown when a URL cannot be mapped to any kind of resource.

                  >
                  >
                  --
                  Mark Rae
                  ASP.NET MVP
                  http://www.markrae.net

                  Comment

                  • Mark Rae [MVP]

                    #10
                    Re: error running off IIS

                    "gerryR" <gerryr@ONSPAMg erryr.comwrote in message
                    news:%23drD$dQQ JHA.5080@TK2MSF TNGP03.phx.gbl. ..
                    Thanks for that, I had tried that all right but was getting the same
                    error.
                    Next thing would be to do what Jeff suggested yesterday and actually write
                    out the connectionStrin g to a web page to make sure that it's not getting
                    distorted or broken somehow as you're fetching it out of web.config...


                    --
                    Mark Rae
                    ASP.NET MVP


                    Comment

                    Working...