0

メソッドの1つが「データベースの更新」であるasp.net AJAXサービスに取り組んでいます。

ローカル IIS で Web サイトをテストしても問題は発生しませんでした。しかし、パブリック IIS にアップロードすると、XMLHttpRequest は常に 400 エラーを返します。

この問題が発生した理由を説明してくれる人はいますか? それを解決するにはどうすればよいですか?私の質問が十分に明確でない場合はお知らせください。

これがサービスを呼び出すコードのプレビューです。

var objFaq = {
        config : {
             isPostBack : false,
             async:false,
             cache:false,
             type :'POST',
             contentType:"application/json; charset=utf-8",
             data:'{}',
             dataType :'json',
             method:'',
             url:'',
             categoryList:"",
             ajaxCallMode:0,
             arr:[],
             arrModule:[]  ,
             baseURL: 'http://www.mywebsite.com/Service/FaqService.asmx/'
            },

        ajaxCallProduct: function(config) {
           $.ajax({
                    type: objFaq.config.type,
                    contentType: objFaq.config.contentType,
                    cache: objFaq.config.cache,
                    async: objFaq.config.async,
                    url: objFaq.config.url,
                    data: objFaq.config.data,
                    dataType: objFaq.config.dataType,
                    success: objFaq.ajaxSuccess,
                    error: objFaq.ajaxFailure                            
                  });
        },

        likeQuestion:function(id)
        {
            try
            {
                this.config.method="Like";
                this.config.url=objFaq.config.baseURL + this.config.method;
                this.config.data = JSON2.stringify({id:id});
                this.config.ajaxCallMode=1;
                this.ajaxCallProduct(this.config);
            }
            catch(e)
            {
                alert(e.message);
            }
        },

        dislikeQuestion:function(id)
        {
            try
            {
                this.config.method="Dislike";
                this.config.url=objFaq.config.baseURL + this.config.method;
                this.config.data = JSON2.stringify({id:id});
                this.config.ajaxCallMode=1;
                this.ajaxCallProduct(this.config);
            }
            catch(e)
            {
                alert(e.message);
            }
        },

        ajaxSuccess: function(data) { 
            switch (objFaq.config.ajaxCallMode) {
              case 0:
              break;    
              case 1:  
              //alert('sukes');
              break;
            }
        },
        ajaxFailure: function(xhr, status, errorThrown) {                
            switch(xhr.status)
            {
                case 400:
                    alert('400' + xhr.responseText);
                    break;
                default:
                    alert(xhr.status);
                    break;
                break;
            }
        }
    };
4

0 に答える 0