在控制台应用程序中消耗oData服务的问题 [英] Problems consuming an oData Service in a Console Application
问题描述
当我使用Vs2011时,无法从控制台应用程序中使用VS2012 RC中的oData服务。
背景和步骤
<我创建了一个LS应用程序 - AppSvc ,它暴露了一个oData接口。这是在新的Azure网站上发布和公开的,使用表单身份验证,并关闭HTTPS(用于测试目的)。
1)我使用LinqPad连接到它 - 没问题
2)我用LS应用程序连接到它 - AppClient 。将外部数据源添加为oData 我提供了URL和凭据。然后我创建了一些针对远程oData源的屏幕。一切正常。
3)我创建了一个Console应用程序,但它无法创建服务。我不断提示输入我的凭据,然后它最终崩溃并报告404错误,尝试访问< URL> / $元数据。
任何想法?这是错误还是人为错误?
谢谢,
Steve
Steve
更新>>
所以我回到AppSvc项目并针对该解决方案创建了一个Console项目应用程序。然后,我在AppSvc上添加了一个服务,该服务不需要在本地进行身份验证。这个 已经创建并添加到我的项目中而没有错误。
在我的控制台应用程序中,我输入了Internet URI和凭据以连接到我的应用程序,一切正常。
SvcX.ApplicationData _Svc = new SvcX.ApplicationData(
new Uri(" http://X.cloudapp.net/ApplicationData.Svc"));
_Svc.Credentials = new System.Net.NetworkCredential(
" Username"," Password");它会在进行身份验证时似乎是一个服务连接问题。
思考?
谢谢,史蒂夫
Unable to consume an oData service in VS2012 RC from a Console application when I could with Vs2011.
Background and Steps
I created a LS application - AppSvc which exposed an oData interface. This is published and exposed on a new Azure Web Site, using forms Authentication, and HTTPS turned off (for test purposes).
1) I connected to it with LinqPad - No problem
2) I connected to it with a LS application - AppClient. Adding the External Data Source as oData I provided the URL and Credentials. I then created some screens against remote oData source. It all worked fine.
3) I created a Console application and it just fails to create the service. I'm continually prompted to enter my credentials, which I do, and then it eventually crashes and reports a 404 error trying to access the <URL>/$metadata.
Any ideas? Is this a bug or human error?
Thanks,
Steve
Steve
Update >>
So I went back to the AppSvc project and against that Solution I created a Console project application. I then added a Service against the AppSvc which didn't require authentication locally. This was created and added to my project without error.
In my Console application I entered the Internet URI and Credentials to connect to my application, and everything worked.
SvcX.ApplicationData _Svc = new SvcX.ApplicationData( new Uri("http://X.cloudapp.net/ApplicationData.Svc")); _Svc.Credentials = new System.Net.NetworkCredential( "Username", "Password");It would seem like its a Service Connection issue when having to authenticate.
Thoughts ?
Thanks, Steve
这篇关于在控制台应用程序中消耗oData服务的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!