VPN gets stuck on “Verifying username and password”

When attempting to connect the VPN gets stuck on “Verifying username and password” (hangs). After a while it then gets stuck on “Connecting to **.**.***.*** using *” and eventually returns a long message and may attempt to redial. The solution below is for messages containing text including GRE.

HYPOTHESES

  1. Also I was using both a laptop and PC with VPN switching to a couple of companies. It may fail on one machine if the other machine is already logged in.
  2. Possibly following a failed connection, I found that a VPN I have used a lot on Windows 7 had a blank User name: when this was normally filled in.

EXPERIMENT

  1. Hypothesis 1:- Reverse the first machine to log in. This time the other machine VPN started failing and in fact scenario 2, the User name became blank.

SOLVED
Create a new VPN which worked, then delete the old VPN

UNSOLVED
For error message 800 there are different problems. One of these is conflict between two computers. There may be a timeout on the server before another computer may connect, possible 30 minutes. Secondly may need to uncheck “Use default gateway on remote network”, this worked once, did not work several times.

ALSO
There are pages on web e.g. however first try above
http://www.sevenforums.com/network-sharing/90522-vpn-not-accepting-incoming-connections.html

Advertisements

Entity Framework: Stored Procedure – Function import

How to…get a stored procedure from SQL and use it in code
In this case execute only, not entity CRUD

  1. Model Browser 
  2. Stored Procedure
  3. Right-click
  4. Update Model from database
  5. Get your stored procedure
  6. However at this point still unusable in code
  7. Not obvious step > Double click Stored Procedure
  8. Choose function import options
  9. OK creates function import which is then useable in code
  10. Note all parameters are surpisingly nullable – May be there is a way preventing this. Unsolved

 

Enjoy !

Entity Framework: WinForms databinding in EF4.1 – DBSet

Solved

Dim context As New SOPEntities
System.Data.Entity.DbExtensions.Load(context.Employees.Where(Function(f) f.Current = True).OrderBy(Function(g) g.FullName))
EmployeeBindingSource.DataSource = context.Employees.Local
ListBox1.DataSource = System.Data.Entity.DbExtensions.Tobindinglist(context.Employees.Local)
ListBox1.DisplayMember = “FullName”

Problem

‘local’ is not a member of ‘System.Data.Objects.ObjectSet(Of <entityname>)’

See http://wp.me/p17IS4-ih

 

Solved

Open the <Name>Model.edmx > Right click > Add code generation item…

Choose ADO.Net DbContext Generator. This has affect of changing the .edmx file Code Generation Strategy to “None” and creates a text template model and .Local now works.

Discussion

Uses EF4.1 EntityFramework.dll
Database first, then add code generation item to get T4 simpler classes and DBSet inherits DBContext
Initially could not work out how to get the Load method. See above for solution.
There is no MSDN VB.Net sample yet. The C# is more like context.Employees.Local.ToBindingList. So it took me a while to work out the syntax above.

Unsolved:
Also the FullName is now a computed column in the database. Was unable to work out how to do this in EF. It may come in the future as a “Model Defined Function”. Do not think this is a Scalar or Complex Type which is something else.
Unsolved:
For BindingSource to support complex filter it needs to support IBindingListView. Typically EF does not.

Links

Binding Objects to Controls
http://msdn.microsoft.com/en-us/library/gg197521(v=VS.103).aspx

Following is in C#
http://msdn.microsoft.com/en-us/library/gg197523(v=VS.103).aspx

Entity Connection String at run-time

 

Following is useful

Public Shared Function GetRunTimeEntityConnectionString(EntityConnectionStringName As String) As String
Dim currentConString = Configuration.ConfigurationManager.ConnectionStrings(EntityConnectionStringName).ConnectionString
Dim builder As New EntityClient.EntityConnectionStringBuilder(currentConString)
builder.ProviderConnectionString = <“NewConString”>
‘builder.Metadata = “res://*/LookupModel.csdl|res://*/LookupModel.ssdl|res://*/LookupModel.msl”
‘builder.Provider = “System.Data.SqlClient”
Return builder.ConnectionString
End Function

Usage
Dim EntityConnectionString = RuntimeConnectionString.GetRunTimeEntityConnectionString(<EntityConStringName>)
context = New <Namespace>.EntityModel.<EntityName>Entities(EntityConnectionString)

If trying to change actual SharedApp.config as follows then currently get an error.
Configuration.ConfigurationManager.ConnectionStrings(<“Name of Entity ConString”>).ConnectionString = RunTimeEntityConnectionString
Error:
system.configuration.configurationerrorsexception the configuration is read only

There are suggested methods for solving this online

Error on Project Settings “An error occurred while reading the app.config file” when using configSource

Error: on opening Project > Settings
“An error occurred while reading the app.config file. The file might be corrupted or contain invalid XML”
However all functionality works

Occurs when using
<connectionStrings configSource=SharedApp.config></connectionStrings>

Solution: Unknown

Cannot create an instance of OLE DB provider “VFPOLEDB” for linked server “Opera”.

Unsolved

Msg 7302, Level 16, State 1, Line 1
Cannot create an instance of OLE DB provider “VFPOLEDB” for linked server “”.

Click here for one part of solution Social.msdn

in Server Objects > Linked Servers > Providers > VFPOLEDB > General tab > Provider options > Allow inprocess. Also, you can
change the InProcess setting with the following code:

USE [master]
GO
EXEC master.dbo.sp_MSset_oledb_prop N’VFPOLEDB’, N’AllowInProcess’, 1
GO

Then get a new message
OLE DB provider “VFPOLEDB” for linked server “Opera” returned message “Invalid path or file name.”.

Cannot initialize the data source object of OLE DB provider “VFPOLEDB” for linked server