我可以手动访问URL,但是使用.Net时会超时。
我创建了一个按钮,可以更轻松地复制场景。有时我会收到一个异常消息,说明任务已被取消,否则出现此代码段之后的504错误:
private async void Button_Click_1(object sender, RoutedEventArgs e)
{
var url = "http://api.dailyfive.tv/index.php?task=REQUEST_REGIONS&session=TestWin8&app=4&model=TestWin8&ver=1.0.0.7&os=8®ion=";
var output = await ReadHttpResponse(url);
}
private async Task<string> ReadHttpResponse(string url)
{
try
{
using (HttpClient client = new HttpClient())
{
HttpResponseMessage response = await client.GetAsync(url);
return await response.Content.ReadAsStringAsync();
}
}
catch (Exception ex)
{
}
return null;
}
Run Code Online (Sandbox Code Playgroud)
结果如下:
<html>
<head><title>504 Gateway Time-out</title></head>
<body bgcolor="white">
<center><h1>504 Gateway Time-out</h1></center>
<hr><center>nginx/1.2.0</center>
</body>
</html>
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 gradle 将 Robobing 与 AspectJ 添加到 Android Studio 中的新项目中。当我单击“将项目与 Gradle 文件同步”时,该过程仍停留在“Gradle:下载https://jcenter.bintray.com/org/aspectj/aspectjtools/1.8.2/aspectjtools-1.8.2.jar ”最后8小时过夜。它没有超时或抛出一些错误。
我尝试手动下载aspectjtools-1.8.2.jar并将其放置在C:\Users\Knobloch.gradle\caches\modules-2\files-2.1\org.aspectj\aspectjtools\1.8.2中,但从附近的文件夹中发现他们有我需要的某种 GUID 子文件夹。
我尝试在 libs 文件夹中手动添加 jar 并使用:
compile files('libs/aspectjtools-1.8.2.jar')
Run Code Online (Sandbox Code Playgroud)
这不起作用。(现在我注意到模块配置中的 gradle 编译树函数是多余的)。
这是我的项目 build.gradle 的相关部分:
buildscript {
repositories {
jcenter()
maven() {
name 'RoboBinding AspectJPlugin Maven Repository'
url "https://github.com/RoboBinding/RoboBinding-aspectj-plugin/raw/master/mavenRepo"
}
}
dependencies {
classpath 'org.robobinding:aspectj-plugin:0.8.4'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
}
}
apply plugin: 'org.robobinding.android-aspectj'
apply plugin: 'com.neenbedankt.android-apt'
Run Code Online (Sandbox Code Playgroud)
以及我的 Module:app build.gradle 中的相关部分:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:support-v4:22.2.0'
compile "org.robobinding:robobinding:$robobindingVersion"
aspectPath "org.robobinding:robobinding:$robobindingVersion"
//alternatively …Run Code Online (Sandbox Code Playgroud)