首页 新闻 搜索 专区 学院

jquery的ajax无法访问iis的webserver

0
悬赏园豆:100 [已关闭问题] 关闭于 2011-11-07 16:42

问题如题,我在项目中已经添加了web引用,引用得是我项目中得webserver,下面的添加web引用自动生成的代码。

Reference.map
1 <?xml version="1.0" encoding="utf-8"?>
2 <DiscoveryClientResultsFile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
3 <Results>
4 <DiscoveryClientResult referenceType="System.Web.Services.Discovery.DiscoveryDocumentReference" url="http://192.168.1.122:8088/WebServer/UserService.asmx?disco" filename="UserService.disco" />
5 <DiscoveryClientResult referenceType="System.Web.Services.Discovery.ContractReference" url="http://192.168.1.122:8088/WebServer/UserService.asmx?wsdl" filename="UserService.wsdl" />
6 </Results>
7 </DiscoveryClientResultsFile>
UserService.disco
1 <?xml version="1.0" encoding="utf-8"?>
2 <discovery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/disco/">
3 <contractRef ref="http://192.168.1.122:8088/WebServer/UserService.asmx?wsdl" docRef="http://192.168.1.122:8088/WebServer/UserService.asmx" xmlns="http://schemas.xmlsoap.org/disco/scl/" />
4 <soap address="http://192.168.1.122:8088/WebServer/UserService.asmx" xmlns:q1="http://tempuri.org/" binding="q1:UserServiceSoap" xmlns="http://schemas.xmlsoap.org/disco/soap/" />
5 <soap address="http://192.168.1.122:8088/WebServer/UserService.asmx" xmlns:q2="http://tempuri.org/" binding="q2:UserServiceSoap12" xmlns="http://schemas.xmlsoap.org/disco/soap/" />
6 </discovery>
UserService.wsdl
 1 <?xml version="1.0" encoding="utf-8"?>
2 <wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
3 <wsdl:types>
4 <s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
5 <s:element name="RegisterDetail">
6 <s:complexType>
7 <s:sequence>
8 <s:element minOccurs="0" maxOccurs="1" name="UserID" type="s:string" />
9 <s:element minOccurs="0" maxOccurs="1" name="NickName" type="s:string" />
10 <s:element minOccurs="0" maxOccurs="1" name="UserPwd" type="s:string" />
11 <s:element minOccurs="0" maxOccurs="1" name="Email" type="s:string" />
12 <s:element minOccurs="0" maxOccurs="1" name="RealName" type="s:string" />
13 <s:element minOccurs="0" maxOccurs="1" name="CertificateType" type="s:string" />
14 <s:element minOccurs="0" maxOccurs="1" name="CertificateNum" type="s:string" />
15 <s:element minOccurs="0" maxOccurs="1" name="Sex" type="s:string" />
16 <s:element minOccurs="0" maxOccurs="1" name="Phone" type="s:string" />
17 <s:element minOccurs="0" maxOccurs="1" name="BackUpPhone" type="s:string" />
18 </s:sequence>
19 </s:complexType>
20 </s:element>
21 <s:element name="RegisterDetailResponse">
22 <s:complexType />
23 </s:element>
24 <s:element name="Regster">
25 <s:complexType>
26 <s:sequence>
27 <s:element minOccurs="0" maxOccurs="1" name="UserID" type="s:string" />
28 <s:element minOccurs="0" maxOccurs="1" name="NickName" type="s:string" />
29 <s:element minOccurs="0" maxOccurs="1" name="UserPwd" type="s:string" />
30 <s:element minOccurs="0" maxOccurs="1" name="Email" type="s:string" />
31 </s:sequence>
32 </s:complexType>
33 </s:element>
34 <s:element name="RegsterResponse">
35 <s:complexType />
36 </s:element>
37 <s:element name="Login">
38 <s:complexType>
39 <s:sequence>
40 <s:element minOccurs="0" maxOccurs="1" name="UserID" type="s:string" />
41 <s:element minOccurs="0" maxOccurs="1" name="UserPwd" type="s:string" />
42 </s:sequence>
43 </s:complexType>
44 </s:element>
45 <s:element name="LoginResponse">
46 <s:complexType />
47 </s:element>
48 <s:element name="KeepLogin">
49 <s:complexType />
50 </s:element>
51 <s:element name="KeepLoginResponse">
52 <s:complexType />
53 </s:element>
54 <s:element name="IsLogin">
55 <s:complexType />
56 </s:element>
57 <s:element name="IsLoginResponse">
58 <s:complexType />
59 </s:element>
60 <s:element name="LoginOut">
61 <s:complexType />
62 </s:element>
63 <s:element name="LoginOutResponse">
64 <s:complexType />
65 </s:element>
66 </s:schema>
67 </wsdl:types>
68 <wsdl:message name="RegisterDetailSoapIn">
69 <wsdl:part name="parameters" element="tns:RegisterDetail" />
70 </wsdl:message>
71 <wsdl:message name="RegisterDetailSoapOut">
72 <wsdl:part name="parameters" element="tns:RegisterDetailResponse" />
73 </wsdl:message>
74 <wsdl:message name="RegsterSoapIn">
75 <wsdl:part name="parameters" element="tns:Regster" />
76 </wsdl:message>
77 <wsdl:message name="RegsterSoapOut">
78 <wsdl:part name="parameters" element="tns:RegsterResponse" />
79 </wsdl:message>
80 <wsdl:message name="LoginSoapIn">
81 <wsdl:part name="parameters" element="tns:Login" />
82 </wsdl:message>
83 <wsdl:message name="LoginSoapOut">
84 <wsdl:part name="parameters" element="tns:LoginResponse" />
85 </wsdl:message>
86 <wsdl:message name="KeepLoginSoapIn">
87 <wsdl:part name="parameters" element="tns:KeepLogin" />
88 </wsdl:message>
89 <wsdl:message name="KeepLoginSoapOut">
90 <wsdl:part name="parameters" element="tns:KeepLoginResponse" />
91 </wsdl:message>
92 <wsdl:message name="IsLoginSoapIn">
93 <wsdl:part name="parameters" element="tns:IsLogin" />
94 </wsdl:message>
95 <wsdl:message name="IsLoginSoapOut">
96 <wsdl:part name="parameters" element="tns:IsLoginResponse" />
97 </wsdl:message>
98 <wsdl:message name="LoginOutSoapIn">
99 <wsdl:part name="parameters" element="tns:LoginOut" />
100 </wsdl:message>
101 <wsdl:message name="LoginOutSoapOut">
102 <wsdl:part name="parameters" element="tns:LoginOutResponse" />
103 </wsdl:message>
104 <wsdl:portType name="UserServiceSoap">
105 <wsdl:operation name="RegisterDetail">
106 <wsdl:input message="tns:RegisterDetailSoapIn" />
107 <wsdl:output message="tns:RegisterDetailSoapOut" />
108 </wsdl:operation>
109 <wsdl:operation name="Regster">
110 <wsdl:input message="tns:RegsterSoapIn" />
111 <wsdl:output message="tns:RegsterSoapOut" />
112 </wsdl:operation>
113 <wsdl:operation name="Login">
114 <wsdl:input message="tns:LoginSoapIn" />
115 <wsdl:output message="tns:LoginSoapOut" />
116 </wsdl:operation>
117 <wsdl:operation name="KeepLogin">
118 <wsdl:input message="tns:KeepLoginSoapIn" />
119 <wsdl:output message="tns:KeepLoginSoapOut" />
120 </wsdl:operation>
121 <wsdl:operation name="IsLogin">
122 <wsdl:input message="tns:IsLoginSoapIn" />
123 <wsdl:output message="tns:IsLoginSoapOut" />
124 </wsdl:operation>
125 <wsdl:operation name="LoginOut">
126 <wsdl:input message="tns:LoginOutSoapIn" />
127 <wsdl:output message="tns:LoginOutSoapOut" />
128 </wsdl:operation>
129 </wsdl:portType>
130 <wsdl:binding name="UserServiceSoap" type="tns:UserServiceSoap">
131 <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
132 <wsdl:operation name="RegisterDetail">
133 <soap:operation soapAction="http://tempuri.org/RegisterDetail" style="document" />
134 <wsdl:input>
135 <soap:body use="literal" />
136 </wsdl:input>
137 <wsdl:output>
138 <soap:body use="literal" />
139 </wsdl:output>
140 </wsdl:operation>
141 <wsdl:operation name="Regster">
142 <soap:operation soapAction="http://tempuri.org/Regster" style="document" />
143 <wsdl:input>
144 <soap:body use="literal" />
145 </wsdl:input>
146 <wsdl:output>
147 <soap:body use="literal" />
148 </wsdl:output>
149 </wsdl:operation>
150 <wsdl:operation name="Login">
151 <soap:operation soapAction="http://tempuri.org/Login" style="document" />
152 <wsdl:input>
153 <soap:body use="literal" />
154 </wsdl:input>
155 <wsdl:output>
156 <soap:body use="literal" />
157 </wsdl:output>
158 </wsdl:operation>
159 <wsdl:operation name="KeepLogin">
160 <soap:operation soapAction="http://tempuri.org/KeepLogin" style="document" />
161 <wsdl:input>
162 <soap:body use="literal" />
163 </wsdl:input>
164 <wsdl:output>
165 <soap:body use="literal" />
166 </wsdl:output>
167 </wsdl:operation>
168 <wsdl:operation name="IsLogin">
169 <soap:operation soapAction="http://tempuri.org/IsLogin" style="document" />
170 <wsdl:input>
171 <soap:body use="literal" />
172 </wsdl:input>
173 <wsdl:output>
174 <soap:body use="literal" />
175 </wsdl:output>
176 </wsdl:operation>
177 <wsdl:operation name="LoginOut">
178 <soap:operation soapAction="http://tempuri.org/LoginOut" style="document" />
179 <wsdl:input>
180 <soap:body use="literal" />
181 </wsdl:input>
182 <wsdl:output>
183 <soap:body use="literal" />
184 </wsdl:output>
185 </wsdl:operation>
186 </wsdl:binding>
187 <wsdl:binding name="UserServiceSoap12" type="tns:UserServiceSoap">
188 <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
189 <wsdl:operation name="RegisterDetail">
190 <soap12:operation soapAction="http://tempuri.org/RegisterDetail" style="document" />
191 <wsdl:input>
192 <soap12:body use="literal" />
193 </wsdl:input>
194 <wsdl:output>
195 <soap12:body use="literal" />
196 </wsdl:output>
197 </wsdl:operation>
198 <wsdl:operation name="Regster">
199 <soap12:operation soapAction="http://tempuri.org/Regster" style="document" />
200 <wsdl:input>
201 <soap12:body use="literal" />
202 </wsdl:input>
203 <wsdl:output>
204 <soap12:body use="literal" />
205 </wsdl:output>
206 </wsdl:operation>
207 <wsdl:operation name="Login">
208 <soap12:operation soapAction="http://tempuri.org/Login" style="document" />
209 <wsdl:input>
210 <soap12:body use="literal" />
211 </wsdl:input>
212 <wsdl:output>
213 <soap12:body use="literal" />
214 </wsdl:output>
215 </wsdl:operation>
216 <wsdl:operation name="KeepLogin">
217 <soap12:operation soapAction="http://tempuri.org/KeepLogin" style="document" />
218 <wsdl:input>
219 <soap12:body use="literal" />
220 </wsdl:input>
221 <wsdl:output>
222 <soap12:body use="literal" />
223 </wsdl:output>
224 </wsdl:operation>
225 <wsdl:operation name="IsLogin">
226 <soap12:operation soapAction="http://tempuri.org/IsLogin" style="document" />
227 <wsdl:input>
228 <soap12:body use="literal" />
229 </wsdl:input>
230 <wsdl:output>
231 <soap12:body use="literal" />
232 </wsdl:output>
233 </wsdl:operation>
234 <wsdl:operation name="LoginOut">
235 <soap12:operation soapAction="http://tempuri.org/LoginOut" style="document" />
236 <wsdl:input>
237 <soap12:body use="literal" />
238 </wsdl:input>
239 <wsdl:output>
240 <soap12:body use="literal" />
241 </wsdl:output>
242 </wsdl:operation>
243 </wsdl:binding>
244 <wsdl:service name="UserService">
245 <wsdl:port name="UserServiceSoap" binding="tns:UserServiceSoap">
246 <soap:address location="http://192.168.1.122:8088/WebServer/UserService.asmx" />
247 </wsdl:port>
248 <wsdl:port name="UserServiceSoap12" binding="tns:UserServiceSoap12">
249 <soap12:address location="http://192.168.1.122:8088/WebServer/UserService.asmx" />
250 </wsdl:port>
251 </wsdl:service>
252 </wsdl:definitions>

iis中得web地址是192.168.1.122:8088,我在局域网内访问我的web程序,脚本执行了,但是就是没有访问到我的webserver,我非常的郁闷。下面是我的脚本。

View Code
 1 function login(userID, userPwd) {
2 $.ajax({
3 type: "POST",
4 data: { "UserID": userID, "UserPwd": userPwd },
5 url: "http://192.168.1.122:8088/WebServer/UserService.asmx/Login",
6 success: function (msg) {
7 if (msg == 'ok') {
8 alert("登录成功!");
9 isfirst = true;
10 PageDire();
11 }
12 else {
13 alert("用户名或密码错误!");
14 $("#chkCode").show();
15 $("#imgCheckCode").click();
16 isfirst = false;
17 return false;
18 }
19 }
20 });
21 }

web程序在本机上正确的执行的。脚本是一个登陆按钮的click事件触发的。

希望有高人指点一下。


Viky的主页 Viky | 初学一级 | 园豆:105
提问于:2011-11-07 11:01
< >
分享
所有回答(2)
0

报什么错误?

artwl | 园豆:16536 (专家六级) | 2011-11-07 12:05

点击后什么反应都没有,但是我调过啦。确实可以执行到方法。

支持(0) 反对(0) Viky | 园豆:105 (初学一级) | 2011-11-07 13:13

而且网页没有出现脚本错误。

支持(0) 反对(0) Viky | 园豆:105 (初学一级) | 2011-11-07 13:14
0

因为跨域了。

lanmiao | 园豆:37 (初学一级) | 2011-11-07 14:51

那需要怎么解决呢?

支持(0) 反对(0) Viky | 园豆:105 (初学一级) | 2011-11-07 16:14

@Viky: 放在同个端口的iis,或者在IIS根路径放置一份XML配置文件

支持(0) 反对(0) lanmiao | 园豆:37 (初学一级) | 2011-11-07 20:45
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册