|
Hi,
I deployed the service <b></b>in windows server 2008 R2
i tried to update a record in db using the service. i have used 'put' method for update.
i called the service by ajax as follows -
<pre lang="Javascript"><script type="text/javascript">
function test() {
;
var AssetUpdate = {
logInInfo: { UserName: 'mark.ritter@e-isg.com', Password: 'password' },
asset: {
AssetName: 'a',
Barcode: '1',
AssetDescription: '1',
AssetIDInternal: 'D2907B1D-8AE9-49D8-A905-65DD356858B2',
PeopleIDInternal: 'ED98D0E6-4AB4-41D4-9EC2-5A289D33595B',
LocationIDInternal: '48A986EA-00BE-46FC-A377-C19B63DA540C',
AssetCategoryIDInternal: '6E41C53F-BA24-4A8B-9892-79AF133549C7',
SiteIDInternal: '8A63BD8B-6B1A-4C91-96E5-3DE44FF07BC0',
AssetUsageID: '1',
AssetConditionID: '1',
AssetStatus: '12',
AssetSerialNo: '123',
Price: '12',
PurchaseDate: '01/01/2012',
PurchaseOrderNo: '55',
Quantity: '456',
Vendor: '67',
IsActive: 'True',
AuditDate: '01/01/2012',
AuditStatus: '4353',
Asset_UID: '1',
DataGatherID: '34',
ActualCost: '345',
FederalCost: '435',
MatchCost: '324',
Mfg: 'TEST',
Model: '1',
POLine: '1',
POStatus: '1',
ScannerDeviceCode: '1',
DateModified: '01/01/2012'
}, AssetIDInternal: '5afb3768-db2f-42d1-8c47-3da008c6cdee'
};
try {
$.ajax({
url: "http://172.16.0.110:80/vamsyncservices/api/Asset/UpdateAsset",
type: "PUT",
dataType: 'json',
data: AssetUpdate,
success: function () {
alert("Done");
alert('Asset Updated successfully.');
},
Failure: function () {
alert("Fails");
}
});
}
catch (e) {
alert(e);
}
}
</script></pre>
******************************************************************************
<b><u></u>Config file :</b>
<pre lang="c#"> <system.webServer>
<modules>
<remove name="WebDAVModule"/>
</modules>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Headers" value="Content-Type" />
<add name="Access-Control-Allow-Methods" value="GET, POST, PUT, DELETE, OPTIONS" />
</customHeaders>
</httpProtocol>
<handlers>
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
</system.webServer></pre>
**********************************************************************************
When i run the script i got an error as follows
<pre lang="c#">"<b>XMLHttpRequest cannot load http://rest.e-isg.com/vamsyncservices/api/Asset/UpdateAsset. Origin http://localhost:52265 is not allowed by Access-Control-Allow-Origin</b>."</pre>
Help ?
|
|
|
|