小编imm*_*odi的帖子

缺少CORS标题"Access-Control-Allow-Origin"

我从我的asp.net表单中调用此函数,并在调用ajax时在firebug控制台上收到以下错误.

跨源请求已阻止:同源策略禁止在http://anotherdomain/test.json中读取远程资源.(原因:缺少CORS标题'Access-Control-Allow-Origin').

var url= 'http://anotherdomain/test.json';
        $.ajax({
            url: url,
            crossOrigin: true,
            type: 'GET',
            xhrFields: { withCredentials: true },
            accept: 'application/json'
        }).done(function (data) {
            alert(data);                
        }).fail(function (xhr, textStatus, error) {
            var title, message;
            switch (xhr.status) {
                case 403:
                    title = xhr.responseJSON.errorSummary;
                    message = 'Please login to your server before running the test.';
                    break;
                default:
                    title = 'Invalid URL or Cross-Origin Request Blocked';
                    message = 'You must explictly add this site (' + window.location.origin + ') to the list …
Run Code Online (Sandbox Code Playgroud)

ajax jquery json jsonp cors

52
推荐指数
3
解决办法
18万
查看次数

您尚未登录.请登录并重试

我在app中使用phonegap facebook连接插件(https://github.com/Wizcorp/phonegap-facebook-plugin)进行Facebook身份验证.它一直工作到今天早上.现在突然它停止工作并为iOS和Android的不同设备提供如下错误:

对于Android:

您尚未登录.您尚未登录.请登录并重试.

对于iOS:

应用程序配置不允许使用URL:应用程序的设置不允许使用一个或多个给定的URL.要使用此URL,您必须在应用程序的设置中添加有效的本机平台

我正在使用以下代码config.xml:

<gap:plugin name="com.phonegap.plugins.facebookconnect" version="0.9.0">    
     <param name="APP_ID" value="99885XXXXXXXXX" />
     <param name="APP_NAME" value="Test App" />
</gap:plugin>
Run Code Online (Sandbox Code Playgroud)

facebook来电:

function fbLogin() {
        facebookConnectPlugin.login(
        ["public_profile", "email"],
        function (response) {
            var OAuthToken = response.authResponse.accessToken;
            var OAuthAccessToken = response.authResponse.userID;
            if (response.authResponse) {
                facebookConnectPlugin.api('/me', null,
                    function (me_response) {
                        alert("Success: " + me_response);
                        facebookConnectPlugin.logout(function (response) {}, function (response) {});                            
                    });
            }                
        },
        function (response) {                
            alert("Error: " + me_response);
        }
    );
}
Run Code Online (Sandbox Code Playgroud)

不知道这里有什么问题.

android facebook ios phonegap-plugins cordova

29
推荐指数
1
解决办法
4万
查看次数

如何在Solr 5中创建新核心?

目前,我们正在使用Apache Solr 4.10.3H alliosearch DS olr [HDS]作为搜索引擎来索引我们的数据.

在那之后,我在上个月得到了有关Apache Solr 5.0.0版本的消息.我成功安装了Apache Solr 5.0.0版本,现在它在8983端口上正常运行(意味着只运行solr但无法创建核心).在该UI中,我无法找到示例核心以及其下的架构或配置文件.所以,我开始创建新的核心,因为我们在旧版本中创建但无法创建一个.以下是错误,我得到它:

错误创建SolrCore'testcore1':无法创建核心[testcore1]引起:找不到集合testcore1的configName:null

注意:我也看到了Solr UI左侧的Cloud选项卡(即http:// localhost:8983/solr /),也不知道它是如何工作的?含义由于缺少示例文件夹(Collection1)以及如何更新这些文件schema.xml,我不知道solrconfig.xml文件的位置?

是否有任何有用的文档或解决方案可用于解决此错误?

lucene solr core

20
推荐指数
3
解决办法
5万
查看次数

跨源请求被阻止原因:CORS预检信道未成功

我创建了一个phonegap应用程序,我正在调用WCF服务,该服务位于nopCommerce插件中.

我在发送api请求时遇到以下错误:

跨源请求已阻止:同源策略禁止在http://testwebsite.com/Plugins/NopRestApi/RemoteService/WebService.svc/GetData上读取远程资源.(原因:CORS预检频道没有成功).

跨源请求已阻止:同源策略禁止在http://testwebsite.com/Plugins/NopRestApi/RemoteService/WebService.svc/GetData上读取远程资源.(原因:CORS请求失败).

使用Ajax进行API调用

$.ajax({
  crossDomain: true,
  type: "POST",
  contentType: "application/json",
  async: false,
  url: "http://testwebsite.com/Plugins/NopRestApi/RemoteService/WebService.svc/GetData",
  data: "{storeId:" + storeId + ", languageId:" + languageId + ", customerId:" + customerId + "}",            
  //data: { storeId: storeId, languageId: languageId, customerId: customerId },
  dataType: 'json',
  //jsonp: false,
  success: function (data) {
      alert(data.d);                
  },
  error: function (xhr, textStatus, error) {
      alert("Error! " + error);                
  }
});
Run Code Online (Sandbox Code Playgroud)

我通过谷歌的一些研究在我的Web.config文件中添加了以下内容.

<httpProtocol>
  <customHeaders>
    <add name="Access-Control-Allow-Origin" value="*" />
    <add name="Access-Control-Allow-Headers" value="Content-Type" />
  </customHeaders>
</httpProtocol> …
Run Code Online (Sandbox Code Playgroud)

wcf cross-domain nopcommerce phonegap-plugins

6
推荐指数
1
解决办法
2万
查看次数

.NET中3层和n层架构的主要区别?

我搜索谷歌找到.net中3层和n层架构的主要区别,但我没有找到它.一些网站表示两者性质相同,有些网站表示它们之间存在差异.

我想知道主要的差异,哪一个在性能优化方面更好?

.net 3-tier n-tier-architecture

4
推荐指数
2
解决办法
3万
查看次数

使用C#将字节转换为图像并将图像转换为字节

目前,我正在与asp.net and c#将图像存储到MySql(使用Blob数据类型)。我已经成功地将其存储到数据库中,但是现在的问题是how can i retrieve that byte[] to image format ?

功能: code to convert byte[] to image

public Image byteArrayToImage(byte[] byteArrayIn)
    {
        MemoryStream ms = new MemoryStream(byteArrayIn);
        Image returnImage = Image.FromStream(ms); --> here gives me error as `parameter is not valid`
        return returnImage;

    }
Run Code Online (Sandbox Code Playgroud)

改写为数据表...

if (dt1.Rows.Count > 0)
        {
            byteArrayToImage((byte[]) dt1.Rows[0]["PortfolioSlideImages"]);
            //MemoryStream ms = new MemoryStream((byte[])dt1.Rows[0]["PortfolioSlideImages"]);
            //Image returnImage = Image.FromStream(ms);
            //return returnImage;
        }
Run Code Online (Sandbox Code Playgroud)

c# mysql image bytearray typeconverter

0
推荐指数
1
解决办法
6104
查看次数