我是 android 开发的新手,并试图通过改造库在 android 中调用本地 .NET web api 服务。在 IIS 上启动我的 web api 后,我收到此错误无法连接到 localhost/127.0.0.1 android。
当我按照建议的http://themakeinfo.com/2015/04/retrofit-android-tutorial/做同样的事情时,它工作正常,但我的本地主机服务没有从 android 调用
我的服务网址是, http://localhost:52511/api/Values/getAllStudents/5
它也在浏览器中为我提供了 XML 格式的输出。
我也试着用,
public interface gitapi {
@GET("/api/Values/GetProduct/{id}") //here is the other url part.best way is to start using /
public void getFeed(@Path("id") int id, Callback<gitmodel> response);
}
public class gitmodel {
public int studentId;
public String studentName;
public String studentAddress;
}
String API = "http://10.0.2.2:52511";
public void CallService(View view){
RestAdapter restAdapter = new RestAdapter.Builder().setEndpoint(API).build();
gitapi …
Run Code Online (Sandbox Code Playgroud) 我正在开发使用谷歌地图的移动应用程序,我想通过设备纬度和经度查找用户当前地址(反向地理编码)。
谷歌有一些限制,一旦超出它就会向我收费。现在我正在寻找OpenStreetMap,它是开放供公众使用的。我可以使用反向地理编码。
例如http://nominatim.openstreetmap.org/reverse?format=xml&lat=20&lon=71&zoom=18
我的问题是,1)。每天拨打这些电话有限制吗?2)。我需要在某个地方注册吗?3)。还有其他替代方案吗?
提前致谢
我刚刚在android studio中创建了新项目.我是这个工具的新手.问题是,它没有向我显示我的设计,它给了我错误,
This version of the rendering library is more recent than your version of Android Studio. Please update Android Studio
Run Code Online (Sandbox Code Playgroud)
我研究它,通过阅读这个问题,我做了同样的Android Studio渲染库1
但是现在,我在MainActivity.java文件中遇到了java编译错误.
我需要导入任何库吗?
我正在使用Entity Framework 6,VS15,DOT NET 4.5.
在阅读了几篇文章并在这里发布问题后,我得到了一些以异步方式进行数据库操作的答案,现在,请建议我在下面提到的哪种方式有效.
我在Entity Framework中添加了表和存储过程,并使用它执行插入.我真的想让调用异步.
using (var DB = new JodoDataEntities())
{
UserInfo UserInformation = await DB.UserInfoes.Where(x => x.Id == userInfo.UserId).FirstOrDefaultAsync();
if (UserInformation != null)
{
UserInformation.Accuracy = userInfo.Accuracy;
UserInformation.IsOnline = userInfo.IsOnline;
await DB.SaveChangesAsync();
return Ok();
}
}
Run Code Online (Sandbox Code Playgroud)
这工作正常,但我填写,它正在进行两次DB调用,首先获取然后在属性中提供值,然后SaveChanges()
,如果一切都在单个调用中发生,那么它将是伟大的.
这UpdateLocation
是我的存储过程:
using (var DB = new JodoDataEntities())
{
DB.UpdateLocation(userInfo.UserId, userInfo.Accuracy, userInfo.IsOnline);
}
Run Code Online (Sandbox Code Playgroud)
上面的代码工作正常,也有单一的请求.但没有异步.我需要异步调用.
这UpdateLocation
是我的存储过程:
using (var DB = new JodoDataEntities())
{
await DB.Database.SqlQuery<Task>("EXEC UpdateLocation {0}, {1}, {2}", userInfo.UserId, userInfo.Accuracy, userInfo.IsOnline).ToArrayAsync();
}
Run Code Online (Sandbox Code Playgroud)
上面的代码也工作正常,也是异步的.但这是调用存储过程的正确方法吗? …
asp.net async-await entity-framework-6 asp.net-mvc-5 asp.net-web-api2
我使用azure来部署我的新Web API,我是在IIS和azure上部署的新手.
我已将我的Web API添加到azure作为Web应用程序,并且它工作正常,直到我添加了每个API函数的文档.添加说明后,我从HelpPageConfig.cs中取消注释以下行.
config.SetDocumentationProvider(new XmlDocumentationProvider(HttpContext.Current.Server.MapPath("~/App_Data/XmlDocument.xml")));
Run Code Online (Sandbox Code Playgroud)
它在本地运行finr,我能够看到所有描述,但是当我在azure上发布它时,我收到错误说,
Could not find a part of the path 'D:\home\site\wwwroot\App_Data\XmlDocument.xml'.
Run Code Online (Sandbox Code Playgroud)
网站网址:http://mejodo.azurewebsites.net/
我需要改变路径吗?
文件已在我的系统中的D:\ home\site\wwwroot\App_Data目录中创建.
我需要做些什么改变才能让它发挥作用?
asp.net asp.net-mvc-4 asp.net-web-api azure-web-sites asp.net-web-api-helppages
我是 angular2 的新手,并尝试将对象结果绑定到 html 模板。我可以使用 Observable 从 srtvice 获取数据。我也可以在控制台和模板中看到 JSON 数据。但是当我尝试从结果 json 访问属性时,它没有显示如下图所示的数据。
下面是我的该组件的代码,
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { JuniorService } from '../Service/service.junior';
import { Employee } from '../../models/Employee';
@Component({
selector: 'my-getjunior',
template: `<h1>Details of {{id}}
<hr/>
JSON : {{Junior | json}}
<hr/>
Summary : {{junior?.summary}}</h1>`
//templateUrl: './app/Junior/get/junior.get.html'
})
export class JuniorGet implements OnInit
{
errorMessage: string;
Junior: Employee;
id: number;
private sub: any;
constructor (private juniorService: JuniorService, private route: …
Run Code Online (Sandbox Code Playgroud) angularjs-templates angular2-forms angular2-template angular2-services angular