Argument matching parameter 'baseAddresses' narrows from 'Object' to 'System.Uri'

I am creating a WCF Service in a Console application (based on the article. I cannot post the URL to the article. ). I am getting the error in the title of this article on the second DIM statement.

What does it mean?
And how do I eliminate it?

Imports System.ServiceModel
Imports System.ServiceModel.Description

Module Module1
    Dim uri = New Uri("http://localhost:8240/demo/wcf/samples")
    Dim host As New ServiceHost(GetType(PersonService), uri)  '<== Error occurs here. The uri is underlined in blue with this error message.
    Sub Main()

    End Sub
    'Argument matching parameter 'baseAddresses' narrows from 'Object' to 'System.Uri'
End Module

Open in new window

mpdillonAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ste5anSenior DeveloperCommented:
You've declared uri as object instead of Uri.
it_saigeDeveloperCommented:
In other words, by using:
Dim uri = New Uri("http://localhost:8240/demo/wcf/samples")

Open in new window

The compiler creates the uri instance as an System.Object type:Capture.JPGTo resolve you need to explicitly define the uri instances type -
Module Module1
	Dim uri As Uri = New Uri("http://localhost:8240/demo/wcf/samples")
	Dim host As New ServiceHost(GetType(PersonService), uri)

	Sub Main()

	End Sub
End Module

Open in new window

-saige-

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mpdillonAuthor Commented:
So obvious. I must have looked at that line 20 times and never saw it. Just use AS instead of "=".  Thank you.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.