none
.NET Framework Error on Windows 7 using WebRequest RRS feed

  • Question

  • OS: Windows 7 (all latest KB/FP's applied)

    Browser: Internet Explorer 8

    .NET 3.5.1 (all latest updates applied)

     

    I have a .NET Web Control that runs inside Internet Explorer 8. It loads data using the System.Net.WebClient class.

    If I sign in to Windows 7 using the user account that was created during the Windows 7 installation, my .NET control works fine and loads data from my web-server (which is IBM WebSphere, running on a different PC) to the client using the WebClient class.

    However, if I create a new user account, with the same permissions (both member of Administrators, and there is Active Desktop etc. being applied to this PC) as the initial account, then when I run the .NET control I get the following during a call to the WebRequest API...

     

    ERROR: WebRequest: [Configuration system failed to initialize]
        at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey)

       at System.Configuration.ClientConfigurationSystem.PrepareClientConfigSystem(String sectionName)

       at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName)

       at System.Configuration.ConfigurationManager.GetSection(String sectionName)

       at System.Configuration.PrivilegedConfigurationManager.GetSection(String sectionName)

       at System.Diagnostics.DiagnosticsConfiguration.GetConfigSection()

       at System.Diagnostics.DiagnosticsConfiguration.Initialize()

       at System.Diagnostics.DiagnosticsConfiguration.get_Sources()

       at System.Diagnostics.TraceSource.Initialize()

       at System.Net.Logging.InitializeLogging()

       at System.Net.Logging.get_On()

       at System.Net.WebClient.DownloadString(Uri address)

       at System.Net.WebClient.DownloadString(String address)

       at MyControl.Globals.WebRequest(String strURI) in D:\rad7\MyInterface\MyControl\Globals.vb:line 277

    The code is...

     

     

    Public Function WebRequest(ByVal strURI As String) As String

     

    Dim strResult As String = ""

     

    Dim client As WebClient = New WebClient()

     

    Try

     

    Try

     

    Dim strXML As String = strURI

     

    While strXML.Length > 0

    Trace(

    "XML: " & Mid$(strXML, 1, 255))

    strXML = Mid$(strXML, 256)

     

    End While

     

    Catch ex1 As Exception

     

    End Try

    strResult = client.DownloadString(strURI)

    Trace(

    "Result = " & strResult)

     

    Return strResult

     

    Catch ex As Exception

    TraceError(

    "WebRequest: ", ex)

     

    Return ex.StackTrace

     

    End Try

     

    End Function

    Line 277 is the call to DownloadString.

    Looking on the net, this error is often reported as being related to a .NET setup issue. Therefore I followed the instructions here http://www.addictivetips.com/windows-tips/uninstall-net-framework-from-windows-7/ to remove the .NET 3.5 framework and re-install. This did not fix the issue.

    Another solution I found on a few logs was this https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=323659&wa=wsignin1.0 but running these programs didn't work (the 1st succeeded, the 2nd failed).

    Given the program runs OK for one user and not another, same code, I can't think its a coding error which is why I'm looking at the .NET framework configuratio/setup.

    Can anyone shed light on this problem or suggest other solutions? Is there a .NET framework config file that is user-specific that could be causing the problem?

    Tuesday, July 20, 2010 9:47 AM

Answers

  • After some further research I found the problem was down to the permission given to the file 'C:\Windows\Microsoft.NET\Framework\v2.0.50727\Config\machine.config'. The default install of >NEt as part of Windows 7 Enterprise seemed to have given permission to this file only by the creator/owner which was why the user account that was created during the installation of Windows 7 was OK.

    I changed the permission to read for all members of Users and the IE8 add-in worked.

    So folks, if you get any access issues with config files in .NET on Windows 7, check your permissions!!!

     

    • Marked as answer by Sanx72 Wednesday, July 21, 2010 6:49 AM
    Wednesday, July 21, 2010 6:49 AM

All replies

  • Hi Sanx72,

    Based on your description, it looks like that you're developing some extensions for Internet Explorer.

    This forum is for the support of .NET Framework installation.
    If your question is related to the extension of IE, I would suggest you to try Internet Explorer Extension Development forum. You will get more useful help there.

    Hope this helps! If I misunderstood, please feel free to let me know.

    Best regards,
    Yichun Chen
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg@microsoft.com
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Wednesday, July 21, 2010 5:20 AM
  • After some further research I found the problem was down to the permission given to the file 'C:\Windows\Microsoft.NET\Framework\v2.0.50727\Config\machine.config'. The default install of >NEt as part of Windows 7 Enterprise seemed to have given permission to this file only by the creator/owner which was why the user account that was created during the installation of Windows 7 was OK.

    I changed the permission to read for all members of Users and the IE8 add-in worked.

    So folks, if you get any access issues with config files in .NET on Windows 7, check your permissions!!!

     

    • Marked as answer by Sanx72 Wednesday, July 21, 2010 6:49 AM
    Wednesday, July 21, 2010 6:49 AM
  • Hi Sanx72,

    I'm so glad to hear this good news and really appreciate your kindly sharing here.
    I believe that this will benefit other community members as well.

    Have a nice day!

    Best regards,
    Yichun Chen
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg@microsoft.com
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Wednesday, July 21, 2010 6:52 AM