« Previous Next »

Thread: NEW INFO ADDED - IIS 7.0 and web service. Publishing from VS 2008 not working

Last post 07-16-2009 11:34 PM by Leo Tang - MSFT. 1 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (2 items)

Sort Posts:

  • 07-14-2009, 8:48 AM

    • coreymas
    • Not Ranked
    • Joined on 04-04-2005, 3:11 PM
    • Posts 1

    NEW INFO ADDED - IIS 7.0 and web service. Publishing from VS 2008 not working

    Hello everyone.

    I have IIS7 installed and i have used the publish feature from VS2008 to publish a web service to the server.

    The web service works when i run it through VS2008... but when i try to test it via URL on the IIS server i get a Generic 500 error.  I am able to see the service and the method... send the method parameters etc but when I click on the invoke button i get the 500 error.

    My web service method accesses a SQL Server instance and it is using a SQL Authentication connection.

    I am guessing that this is a security/configuration issue.. but i do not know where to start looking to fix this.

    Edit more info

    This is the error I am getting (which is confusing because i am not getting this in VS2008

    System.NullReferenceException: Object reference not set to an instance of an object.
       at PortalWebService.PortalWebService.VerifyStudentLogin(String UserName, String Password, Int32 LoginType) in D:\Projects\PortalWebService\PortalWebService\PortalWebService\PortalWebService.asmx.vb:line 19

    Line 19 in my code is my connection string line (if i can trust the line numbering scheme in VS2008

    Dim conn As New SqlConnection(rootWebConfig.ConnectionStrings.ConnectionStrings("PortalConnectionString").ConnectionString)

    And yes this string does exist in my WebConfig.

    I Have narrowed this down a bit... when i use a connection string in a web config file it fails... but if i hard code the string in the VB code it works..... why is it having trouble accessing/reading the web config file of my application?

    Any help would be appreciated.

    Corey

  • 07-16-2009, 11:34 PM In reply to

    Re: NEW INFO ADDED - IIS 7.0 and web service. Publishing from VS 2008 not working

    Hi,

    How do you initialize the rootWebConfig?  If you are going to obtain configuration information from the application in which your code resides, you can use the static method. It looks like this:
    Dim conn As New SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings("PortalConnectionString").ConnectionString)

    Actually, this is an ASP.Net issue.

    Leo Tang
    Microsoft Online Community Support

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Page 1 of 1 (2 items)